/* =====================================================================
   Pixora — Image Converter
   Session 1 stylesheet (professional responsive UI)
   Blue / purple accents, light background, rounded cards, soft shadows.
   ===================================================================== */

:root {
    /* Brand palette (from Pixora logo vector) */
    --pix-blue:        #0B63F6;
    --pix-blue-2:      #315BFF;
    --pix-purple:      #7B2FF7;
    --pix-purple-2:    #6E41F5;
    --pix-navy:        #17203a;   /* deep indigo-slate brand strip (was near-black #091225) */

    --pix-gradient:    linear-gradient(135deg, #0B63F6 0%, #315BFF 45%, #7B2FF7 100%);
    --pix-gradient-soft: linear-gradient(135deg, rgba(11,99,246,.10) 0%, rgba(123,47,247,.10) 100%);

    /* Neutrals (Session 12E.4 — professional cool-slate palette) */
    --pix-bg:          #f5f7fb;
    --pix-bg-accent:   #eef1fb;
    --pix-surface:     #ffffff;
    --pix-border:      #e2e8f0;
    --pix-text:        #1e293b;
    --pix-text-muted:  #64748b;

    /* Effects */
    --pix-radius:      16px;
    --pix-radius-sm:   10px;
    --pix-shadow:      0 8px 28px rgba(31, 43, 92, 0.08);
    --pix-shadow-sm:   0 3px 12px rgba(31, 43, 92, 0.07);
    --pix-focus:       0 0 0 .2rem rgba(49, 91, 255, .30);

    /* Sizing */
    --pix-touch:       44px;   /* minimum touch target */
    --pix-header-h:    76px;
}

/* ---------------------------------------------------------------------
   Base
--------------------------------------------------------------------- */
* { box-sizing: border-box; }

/* Ensure the [hidden] attribute always wins, even over display utilities
   like .btn (display:inline-flex). Used for Download ZIP, image list, etc. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background:
        radial-gradient(1200px 480px at 50% -260px, var(--pix-bg-accent) 0%, rgba(238,241,251,0) 70%),
        var(--pix-bg);
    color: var(--pix-text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    /* leave space for fixed action bar */
    padding-bottom: 96px;
    overflow-x: hidden;   /* guard against horizontal scroll */
}

img { max-width: 100%; height: auto; }

a { color: var(--pix-blue); text-decoration: none; }
a:hover { color: var(--pix-purple); }

.text-brand { color: var(--pix-blue) !important; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: .5rem;
    z-index: 1080;
    background: #fff;
    padding: .5rem .9rem;
    border-radius: var(--pix-radius-sm);
    box-shadow: var(--pix-shadow-sm);
}

/* ---------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------- */
.btn {
    --bs-btn-font-weight: 600;
    border-radius: var(--pix-radius-sm);
    min-height: var(--pix-touch);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem 1.05rem;
    transition: transform .12s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn i { font-size: 1.05em; line-height: 1; }
.btn:focus-visible { box-shadow: var(--pix-focus); outline: none; }

.btn-brand {
    background: var(--pix-gradient);
    border: none;
    color: #fff;
    box-shadow: 0 6px 16px rgba(49, 91, 255, .28);
}
.btn-brand:hover,
.btn-brand:focus { color: #fff; box-shadow: 0 8px 22px rgba(123, 47, 247, .34); }
.btn-brand--soft { box-shadow: 0 4px 12px rgba(123, 47, 247, .30); }

.btn-outline-soft {
    background: var(--pix-surface);
    border: 1px solid var(--pix-border);
    color: var(--pix-text);
}
.btn-outline-soft:hover,
.btn-outline-soft:focus {
    border-color: var(--pix-blue-2);
    color: var(--pix-blue);
    background: #fff;
    box-shadow: var(--pix-shadow-sm);
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--pix-text-muted);
}
.btn-ghost:hover,
.btn-ghost:focus {
    color: var(--pix-blue);
    background: var(--pix-gradient-soft);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a 0%, #12b981 100%);
    border: none;
    color: #fff;
    box-shadow: 0 6px 16px rgba(18, 185, 129, .28);
}
.btn-success:hover, .btn-success:focus { color: #fff; }

/* Disabled state — clearly non-interactive */
.btn:disabled,
.btn.disabled {
    opacity: .55;
    box-shadow: none;
    cursor: not-allowed;
    filter: grayscale(15%);
}

/* ---------------------------------------------------------------------
   Header
--------------------------------------------------------------------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--pix-border);
}
.app-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 0;
    flex-wrap: wrap;
    min-height: var(--pix-header-h);
}
.app-header__brand { display: inline-flex; align-items: center; }
.app-header__logo {
    height: 48px;
    width: auto;          /* preserve aspect ratio, never stretch/crop */
    max-width: 100%;
    object-fit: contain;
    display: block;
}
.app-header__actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---------------------------------------------------------------------
   Layout / main
--------------------------------------------------------------------- */
.app-main { padding: 1.5rem 0 1rem; }

/* ---------------------------------------------------------------------
   Cards
--------------------------------------------------------------------- */
.pixora-card {
    background: var(--pix-surface);
    border: 1px solid var(--pix-border);
    border-radius: var(--pix-radius);
    box-shadow: var(--pix-shadow);
}
.pixora-card .card-body { padding: 1.25rem; }

.pixora-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--pix-text);
}

/* ---------------------------------------------------------------------
   Dropzone / upload
--------------------------------------------------------------------- */
.dropzone {
    border: 2px dashed #c7d0ea;
    border-radius: var(--pix-radius);
    background: var(--pix-gradient-soft);
    text-align: center;
    padding: 1.75rem 1.25rem;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
    border-color: var(--pix-purple);
    background: linear-gradient(135deg, rgba(11,99,246,.14) 0%, rgba(123,47,247,.16) 100%);
    outline: none;
    box-shadow: var(--pix-shadow-sm);
}
.dropzone__icon {
    width: 62px;
    height: 62px;
    margin: 0 auto .75rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    box-shadow: var(--pix-shadow-sm);
}
.dropzone__icon i { font-size: 1.8rem; color: var(--pix-purple); }
.dropzone__title { font-weight: 600; margin: 0 0 .35rem; color: var(--pix-text); }
.dropzone__or {
    position: relative;
    text-align: center;
    color: var(--pix-text-muted);
    font-size: .8rem;
    margin: .35rem 0;
    letter-spacing: .05em;
}
.dropzone__or span { background: transparent; padding: 0 .5rem; position: relative; z-index: 1; }
.dropzone__formats {
    margin: .85rem 0 0;
    font-size: .8rem;
    color: var(--pix-text-muted);
}

/* ---------------------------------------------------------------------
   Settings card
--------------------------------------------------------------------- */
.settings-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}
.settings-form .form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--pix-text-muted);
    margin-bottom: .3rem;
}
.range-value {
    font-size: .82rem;
    font-weight: 700;
    color: var(--pix-purple);
    font-variant-numeric: tabular-nums;
}
.aspect-row {
    background: var(--pix-bg);
    border: 1px solid var(--pix-border);
    border-radius: var(--pix-radius-sm);
    padding: .6rem .8rem;
}
.aspect-row .form-label i { color: var(--pix-purple); }

/* Form controls */
.form-control,
.form-select {
    border-radius: var(--pix-radius-sm);
    border: 1px solid var(--pix-border);
    min-height: var(--pix-touch);
    font-size: .95rem;
    color: var(--pix-text);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--pix-blue-2);
    box-shadow: var(--pix-focus);
}

/* Range sliders */
.form-range { padding: .35rem 0; }
.form-range::-webkit-slider-thumb {
    background: var(--pix-purple);
    box-shadow: 0 2px 6px rgba(123,47,247,.45);
}
.form-range::-moz-range-thumb {
    background: var(--pix-purple);
    border: none;
    box-shadow: 0 2px 6px rgba(123,47,247,.45);
}
.form-range::-webkit-slider-runnable-track { background: #dfe4f3; border-radius: 6px; }
.form-range::-moz-range-track { background: #dfe4f3; border-radius: 6px; }
.form-range:focus { outline: none; }
/* Visible keyboard focus ring on the slider thumb (native outline is removed
   above); preserves the existing thumb drop-shadow and adds the focus ring. */
.form-range:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 2px 6px rgba(123,47,247,.45), var(--pix-focus);
}
.form-range:focus-visible::-moz-range-thumb {
    box-shadow: 0 2px 6px rgba(123,47,247,.45), var(--pix-focus);
}

/* Switch */
.form-switch .form-check-input {
    width: 2.6em;
    height: 1.4em;
    cursor: pointer;
}
.form-check-input:checked {
    background-color: var(--pix-purple);
    border-color: var(--pix-purple);
}
.form-check-input:focus { box-shadow: var(--pix-focus); border-color: var(--pix-blue-2); }

/* ---------------------------------------------------------------------
   Task counter
--------------------------------------------------------------------- */
.task-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    background: var(--pix-surface);
    border: 1px solid var(--pix-border);
    border-radius: var(--pix-radius);
    box-shadow: var(--pix-shadow-sm);
    padding: .75rem 1rem;
    flex-wrap: wrap;
}
.task-counter__left {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    color: var(--pix-text);
}
.task-counter__left i { color: var(--pix-blue); font-size: 1.15rem; }
.badge-slots {
    background: rgba(18, 185, 129, .12);
    color: #0f9d63;
    font-weight: 600;
    border-radius: 999px;
    padding: .4rem .75rem;
    font-size: .78rem;
}

/* ---------------------------------------------------------------------
   Images list / empty state
--------------------------------------------------------------------- */
.images-card { min-height: 420px; }

.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--pix-text-muted);
}
.empty-state__icon {
    width: 88px;
    height: 88px;
    object-fit: contain;
    opacity: .45;
    filter: grayscale(20%);
    margin-bottom: 1rem;
}
.empty-state__title {
    font-weight: 700;
    color: var(--pix-text);
    margin: 0 0 .25rem;
    font-size: 1.05rem;
}
.empty-state__subtitle { margin: 0; font-size: .9rem; }

/* ---------------------------------------------------------------------
   Bottom action bar (fixed)
--------------------------------------------------------------------- */
.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--pix-border);
    padding: .7rem 0;
    box-shadow: 0 -6px 20px rgba(31, 43, 92, .06);
}
.action-bar__inner {
    display: flex;
    align-items: center;
    gap: .75rem 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
}
.action-bar__apply { min-width: 220px; }

/* Session 12E.4C — Codide branding merged into the action bar (left side) */
.action-bar__brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: .9rem;
    color: #64748b;
}
.action-bar__buttons {
    display: flex;
    align-items: center;
    gap: .75rem;
}

/* =====================================================================
   Session 12E.4D — premium hover/focus lift (logo + 3 main action buttons)
   Scoped to the exact elements only; transform-only lift preserves the
   existing focus ring (box-shadow) and branded button shadows.
   ===================================================================== */

/* Top Pixora logo/link */
.app-header__logo {
    transition: transform .2s ease, filter .2s ease;
    transform-origin: left center;
}
.app-header__brand:focus-visible .app-header__logo {
    transform: translateY(-1.5px) scale(1.04);
    filter: drop-shadow(0 6px 14px rgba(49, 91, 255, .28));
}
@media (hover: hover) and (pointer: fine) {
    .app-header__brand:hover .app-header__logo {
        transform: translateY(-1.5px) scale(1.04);
        filter: drop-shadow(0 6px 14px rgba(49, 91, 255, .28));
    }
}

/* Main action buttons: Start New Task, Apply to All Images, Download ZIP.
   Base `.btn` already transitions transform; add filter so the subtle
   shadow-strengthen animates too, without dropping existing smoothing. */
#btnStartNewTask,
#btnApplyAll,
#btnDownloadZip {
    transition: transform .12s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease, filter .18s ease;
}
#btnStartNewTask:focus-visible:not(:disabled),
#btnApplyAll:focus-visible:not(:disabled),
#btnDownloadZip:focus-visible:not(:disabled) {
    transform: translateY(-1.5px) scale(1.035);
    filter: drop-shadow(0 6px 12px rgba(31, 43, 92, .16));
}
@media (hover: hover) and (pointer: fine) {
    #btnStartNewTask:hover:not(:disabled),
    #btnApplyAll:hover:not(:disabled),
    #btnDownloadZip:hover:not(:disabled) {
        transform: translateY(-1.5px) scale(1.035);
        filter: drop-shadow(0 6px 12px rgba(31, 43, 92, .16));
    }
}
#btnStartNewTask:active:not(:disabled),
#btnApplyAll:active:not(:disabled),
#btnDownloadZip:active:not(:disabled) {
    transform: translateY(0) scale(.99);
    filter: none;
}
#btnStartNewTask:disabled,
#btnApplyAll:disabled,
#btnDownloadZip:disabled {
    transform: none;
    filter: none;
}

/* Session 12E.4E — Help & About: same motion style but softer than the primary
   Start New Task button (smaller scale/lift, lighter shadow). */
#btnHelp,
#btnAbout {
    transition: transform .12s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease, filter .18s ease;
}
#btnHelp:focus-visible:not(:disabled),
#btnAbout:focus-visible:not(:disabled) {
    transform: translateY(-1px) scale(1.025);
    filter: drop-shadow(0 4px 10px rgba(31, 43, 92, .12));
}
@media (hover: hover) and (pointer: fine) {
    #btnHelp:hover:not(:disabled),
    #btnAbout:hover:not(:disabled) {
        transform: translateY(-1px) scale(1.025);
        filter: drop-shadow(0 4px 10px rgba(31, 43, 92, .12));
    }
}
#btnHelp:active:not(:disabled),
#btnAbout:active:not(:disabled) {
    transform: translateY(0) scale(.99);
    filter: none;
}
#btnHelp:disabled,
#btnAbout:disabled {
    transform: none;
    filter: none;
}

/* Motion safety — disable the lift/scale movement (focus ring is unaffected). */
@media (prefers-reduced-motion: reduce) {
    .app-header__brand:hover .app-header__logo,
    .app-header__brand:focus-visible .app-header__logo,
    #btnStartNewTask:hover:not(:disabled),
    #btnApplyAll:hover:not(:disabled),
    #btnDownloadZip:hover:not(:disabled),
    #btnStartNewTask:focus-visible:not(:disabled),
    #btnApplyAll:focus-visible:not(:disabled),
    #btnDownloadZip:focus-visible:not(:disabled),
    #btnHelp:hover:not(:disabled),
    #btnAbout:hover:not(:disabled),
    #btnHelp:focus-visible:not(:disabled),
    #btnAbout:focus-visible:not(:disabled),
    .app-footer__codide:hover,
    .app-footer__codide:focus-visible {
        transform: none;
        filter: none;
    }
}

/* ---------------------------------------------------------------------
   Footer
--------------------------------------------------------------------- */
.app-footer {
    background: var(--pix-navy);
    color: #cfd6e6;
    padding: 1.1rem 0;
    text-align: center;
}
.app-footer__text {
    margin: 0;
    font-size: .95rem;
    letter-spacing: .01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.app-footer__brand {
    font-weight: 800;
    background: linear-gradient(135deg, #4d8bff 0%, #9a6bff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #9a6bff;   /* fallback */
}

/* Session 8B — Codide footer logo (replaces the "Codide" text). */
.app-footer__codide {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    border-radius: 6px;
    outline: none;
    transition: opacity .18s ease, transform .18s ease, filter .18s ease;
    transform-origin: left center;
}
.app-footer__codide-logo {
    display: block;
    width: auto;                          /* preserve aspect ratio — never stretch/crop */
    height: clamp(20px, 2.4vw, 30px);     /* sensible responsive height */
    opacity: .92;                         /* true brand colours preserved */
}
/* Brighten the logo on hover/focus (artwork unchanged). */
.app-footer__codide:hover .app-footer__codide-logo,
.app-footer__codide:focus-visible .app-footer__codide-logo {
    opacity: 1;
}
/* Session 12E.4F — premium lift on the whole Codide branding link;
   keeps the existing focus outline and adds a cool-indigo glow. */
.app-footer__codide:focus-visible {
    outline: 2px solid #9a6bff;
    outline-offset: 3px;
    transform: translateY(-1.5px) scale(1.04);
    filter: drop-shadow(0 6px 14px rgba(46, 40, 120, .30));
}
@media (hover: hover) and (pointer: fine) {
    .app-footer__codide:hover {
        transform: translateY(-1.5px) scale(1.04);
        filter: drop-shadow(0 6px 14px rgba(46, 40, 120, .30));
    }
}
.app-footer__codide:active {
    transform: translateY(0) scale(1);
    filter: none;
}

/* ---------------------------------------------------------------------
   Modals
--------------------------------------------------------------------- */
.pixora-modal {
    border: none;
    border-radius: var(--pix-radius);
    box-shadow: 0 24px 60px rgba(31, 43, 92, .28);
}
.pixora-modal .modal-header { border-bottom: 1px solid var(--pix-border); }
.pixora-modal .modal-footer { border-top: 1px solid var(--pix-border); }
.pixora-modal .modal-title { font-weight: 700; }
.about-modal__icon { border-radius: var(--pix-radius-sm); }

/* Progress bar accent */
.progress-bar-brand { background: var(--pix-gradient); }

/* ---------------------------------------------------------------------
   Loading overlay
--------------------------------------------------------------------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(15, 20, 40, .55);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
}
.loading-overlay[hidden] { display: none; }
.loading-overlay__box {
    background: #fff;
    border-radius: var(--pix-radius);
    padding: 1.75rem 2.25rem;
    text-align: center;
    box-shadow: var(--pix-shadow);
}
.loading-overlay__text { margin: .9rem 0 0; font-weight: 600; }
.text-brand.spinner-border { color: var(--pix-purple) !important; }

/* Error alert area */
.error-alert-area {
    position: fixed;
    top: calc(var(--pix-header-h) + .5rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1085;
    width: min(560px, 92vw);
}
.error-alert-area:empty { display: none; }

/* ---------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------- */

/* Tablet and below */
@media (max-width: 991.98px) {
    .images-card { min-height: 320px; }
}

/* Small screens / phones */
@media (max-width: 575.98px) {
    body { font-size: 14px; }

    .app-header__inner { padding: .6rem 0; }
    .app-header__logo { height: 38px; }

    /* Buttons collapse to icons on very small screens to stay tidy */
    .app-header__actions .btn { padding: .5rem .7rem; }
    .app-header__actions .btn span { display: none; }
    .app-header__actions .btn i { font-size: 1.2rem; }

    .pixora-card .card-body { padding: 1rem; }

    .task-counter { padding: .65rem .8rem; }

    /* Action bar stacks cleanly: branding above, buttons full-width below */
    .action-bar__inner { flex-direction: column; align-items: stretch; gap: .6rem; }
    .action-bar__buttons { flex-direction: column; width: 100%; }
    .action-bar__apply,
    .action-bar__download { width: 100%; min-width: 0; }

    .empty-state { padding: 2.5rem 1rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* =====================================================================
   Session 2 — upload feedback, image cards, toasts
   ===================================================================== */

/* Dropzone disabled / busy states */
.dropzone.is-disabled {
    opacity: .6;
    cursor: not-allowed;
    filter: grayscale(20%);
}
.dropzone.is-busy { cursor: progress; }

/* Limit-reached notice */
.limit-notice {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: .9rem;
    padding: .7rem .9rem;
    border-radius: var(--pix-radius-sm);
    background: rgba(220, 38, 38, .08);
    border: 1px solid rgba(220, 38, 38, .22);
    color: #b42318;
}
.limit-notice i { font-size: 1.25rem; flex: 0 0 auto; }
.limit-notice strong { display: block; font-size: .9rem; }
.limit-notice span { font-size: .82rem; color: #9a2318; }

/* Slots badge — full state */
.badge-slots.is-full {
    background: rgba(220, 38, 38, .12);
    color: #b42318;
}

/* Upload queue */
.upload-queue {
    list-style: none;
    margin: .9rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.upload-queue__item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .7rem;
    border-radius: var(--pix-radius-sm);
    background: var(--pix-bg);
    border: 1px solid var(--pix-border);
    font-size: .82rem;
}
.upload-queue__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pix-text); }
.upload-queue__status { flex: 0 0 auto; font-weight: 600; font-size: .76rem; }
.upload-queue__spin {
    flex: 0 0 auto;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid #c7d0ea;
    border-top-color: var(--pix-purple);
    animation: pix-spin .7s linear infinite;
}
.upload-queue__item.is-success .upload-queue__spin { border: none; width: auto; height: auto; animation: none; }
.upload-queue__item.is-success .upload-queue__spin::before { content: "\2713"; color: #0f9d63; font-weight: 700; }
.upload-queue__item.is-success .upload-queue__status { color: #0f9d63; }
.upload-queue__item.is-error .upload-queue__spin { border: none; width: auto; height: auto; animation: none; }
.upload-queue__item.is-error .upload-queue__spin::before { content: "\2715"; color: #b42318; font-weight: 700; }
.upload-queue__item.is-error .upload-queue__status { color: #b42318; }
.upload-queue__item.is-skipped { opacity: .7; }
.upload-queue__item.is-skipped .upload-queue__spin { border: none; animation: none; }

@keyframes pix-spin { to { transform: rotate(360deg); } }

/* Image cards */
.image-card {
    position: relative;
    background: var(--pix-surface);
    border: 1px solid var(--pix-border);
    border-radius: var(--pix-radius);
    box-shadow: var(--pix-shadow-sm);
    overflow: hidden;
    transition: box-shadow .18s ease, transform .16s ease, opacity .16s ease;
    display: flex;
    flex-direction: column;
}
.image-card:hover { box-shadow: var(--pix-shadow); transform: translateY(-2px); }
.image-card.is-removing { opacity: 0; transform: scale(.96); }

.image-card__remove {
    position: absolute;
    top: .45rem;
    right: .45rem;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(9, 18, 37, .62);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.image-card__remove:hover,
.image-card__remove:focus-visible {
    background: #dc2626;
    outline: none;
    box-shadow: 0 0 0 .2rem rgba(220, 38, 38, .35);
}
.image-card__remove:active { transform: scale(.92); }
.image-card__remove:disabled { opacity: .5; cursor: not-allowed; }
.image-card__remove i { font-size: 1rem; }

/* Toasts */
.pixora-toast {
    border: none;
    border-radius: var(--pix-radius-sm);
    color: #fff;
    box-shadow: var(--pix-shadow);
    overflow: hidden;
    margin-bottom: .5rem;
}
.pixora-toast .toast-body {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 500;
    font-size: .88rem;
}
.pixora-toast__msg { flex: 1 1 auto; }
.pixora-toast--success { background: linear-gradient(135deg, #16a34a, #12b981); }
.pixora-toast--error   { background: linear-gradient(135deg, #dc2626, #e11d48); }
.pixora-toast--info    { background: var(--pix-gradient); }

@media (max-width: 575.98px) {
    .image-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* =====================================================================
   Session 3 — professional editor cards + individual settings
   ===================================================================== */

/* Images list becomes a vertical stack of full-width editor cards. */
.image-list {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

/* ---- Editor card shell ---- */
.editor-card {
    container-type: inline-size;
    background: var(--pix-surface);
    border: 1px solid var(--pix-border);
    border-radius: var(--pix-radius);
    box-shadow: var(--pix-shadow-sm);
    overflow: hidden;
    transition: box-shadow .18s ease, opacity .16s ease, transform .16s ease;
}
.editor-card:hover { box-shadow: var(--pix-shadow); }
.editor-card.is-removing { opacity: 0; transform: scale(.98); }

/* ---- Header ---- */
.editor-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--pix-border);
    background: linear-gradient(180deg, rgba(238,241,251,.5), rgba(255,255,255,0));
    flex-wrap: wrap;
}
.editor-card__ident { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.editor-card__format {
    flex: 0 0 auto;
    background: var(--pix-gradient);
    color: #fff;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .28rem .5rem;
    border-radius: 7px;
}
.editor-card__titles { min-width: 0; }
.editor-card__name {
    font-weight: 700;
    font-size: .92rem;
    color: var(--pix-text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 46ch;
}
.editor-card__sub {
    margin: .1rem 0 0;
    font-size: .76rem;
    color: var(--pix-text-muted);
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}
.editor-card__dot { opacity: .55; }
.editor-card__status { color: #0f9d63; font-weight: 600; }
.editor-card__status i { font-size: .85em; }

.editor-card__tools { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }

/* Save-state badge */
.save-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .74rem;
    font-weight: 600;
    padding: .3rem .55rem;
    border-radius: 999px;
    white-space: nowrap;
    border: 1px solid transparent;
}
.save-badge[data-state="saved"]   { background: rgba(15,157,99,.12); color: #0f9d63; }
.save-badge[data-state="unsaved"] { background: rgba(234,179,8,.15); color: #a16207; }
.save-badge[data-state="saving"]  { background: rgba(49,91,255,.12); color: var(--pix-blue); }
.save-badge[data-state="failed"]  { background: rgba(220,38,38,.12); color: #b42318; }
.save-badge[data-state="saving"] .save-badge__ico { animation: pix-spin .8s linear infinite; }

.editor-card__remove {
    position: static;               /* header-anchored, not absolute like S2 */
    width: 40px; height: 40px;
    flex: 0 0 auto;
}

/* ---- Body: split preview columns (top box + image box) + stacked sections
   (Session 12E.3F). Each preview column is two separate boxes; the two top
   boxes share one grid row so they get equal height, which makes both image
   boxes begin at exactly the same vertical level. ---- */
.editor-card__body {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    grid-template-columns: 1fr;
    grid-template-areas:
        "torig"
        "iorig"
        "tedit"
        "iedit"
        "settings"
        "details";
}
.ec-topbox--orig { grid-area: torig; }
.ec-imgbox--orig { grid-area: iorig; }
.ec-topbox--edit { grid-area: tedit; }
.ec-imgbox--edit { grid-area: iedit; }
.editor-panel--settings { grid-area: settings; }
.ec-details             { grid-area: details; }

/* Tablet/desktop: two preview columns side by side; other rows full width */
@container (min-width: 560px) {
    .editor-card__body {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "torig    tedit"
            "iorig    iedit"
            "settings settings"
            "details  details";
    }
}

/* Preview top-information boxes: matched, balanced internal spacing between the
   heading and its second line; equal height comes from the shared grid row. */
.ec-topbox {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}
.ec-topbox .editor-panel__title { margin: 0; }
.ec-topbox .orig-meta { margin: 0; }
.ec-topbox .ec-edited-utils { margin: 0; }
.ec-imgbox { min-width: 0; }

/* Settings sub-sections (Session 12E) */
.ec-section { display: flex; flex-direction: column; gap: .7rem; }

/* Row 4 — Background | Transform balanced columns */
.ec-bgtransform {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}
.ec-bgtransform > .ec-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}
@container (min-width: 560px) {
    .ec-bgtransform { grid-template-columns: 1fr 1fr; }
}

/* Row 5 — details as a balanced two-column grid on wider cards */
@container (min-width: 560px) {
    .ec-details .edited-summary {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .3rem .9rem;
    }
}

.editor-panel { min-width: 0; }
.editor-panel__title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--pix-text-muted);
    margin: 0 0 .55rem;
}

/* ---- Preview frames ---- */
.preview-frame {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--pix-border);
    border-radius: var(--pix-radius-sm);
    background:
        repeating-conic-gradient(#eef1f8 0% 25%, #ffffff 0% 50%) 50% / 18px 18px;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.preview-frame__img {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* never stretch */
    display: block;
}
.preview-frame__state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--pix-text-muted);
    font-size: .8rem;
    background: rgba(255,255,255,.55);
}
.preview-frame__state--error { color: #b42318; }
.preview-frame__state--error i { font-size: 1.5rem; }
.preview-frame__spin {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 3px solid #c7d0ea;
    border-top-color: var(--pix-purple);
    animation: pix-spin .7s linear infinite;
}
.preview-frame__tag {
    position: absolute;
    top: .4rem; right: .4rem;
    background: rgba(9,18,37,.72);
    color: #fff;
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .03em;
    padding: .18rem .4rem;
    border-radius: 6px;
}

/* ---- Meta lists ---- */
.preview-meta, .edited-summary {
    margin: .7rem 0 0;
    display: flex;
    flex-direction: column;
    gap: .28rem;
}
.preview-meta > div, .edited-summary > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: .78rem;
}
.preview-meta dt, .edited-summary dt { color: var(--pix-text-muted); margin: 0; }
.preview-meta dd, .edited-summary dd { margin: 0; font-weight: 600; color: var(--pix-text); text-align: right; }

.edited-note {
    margin: .6rem 0 0;
    font-size: .72rem;
    color: var(--pix-text-muted);
    font-style: italic;
    opacity: .85;
}

/* ---- Individual settings controls ---- */
.ind-settings { display: flex; flex-direction: column; gap: .7rem; }
.ind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.ind-field { display: flex; flex-direction: column; gap: .25rem; margin: 0; }
.ind-label {
    font-size: .76rem;
    font-weight: 600;
    color: var(--pix-text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
}
.ind-value { color: var(--pix-purple); font-weight: 700; font-variant-numeric: tabular-nums; }
.ind-hint { color: var(--pix-text-muted); cursor: help; }

.form-select-sm, .form-control-sm { font-size: .82rem; min-height: 38px; }
.ind-settings .form-range { padding: .2rem 0; }

.ind-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    background: var(--pix-bg);
    border: 1px solid var(--pix-border);
    border-radius: var(--pix-radius-sm);
    padding: .5rem .7rem;
}
.ind-switch .ind-label i { color: var(--pix-purple); }

.ind-color { display: flex; align-items: center; gap: .5rem; }
.form-control-color { width: 46px; min-height: 38px; padding: .2rem; }
.ind-color__hex { font-size: .8rem; font-weight: 600; color: var(--pix-text); font-variant-numeric: tabular-nums; }

/* Future/disabled controls */
.ind-future {
    border-top: 1px dashed var(--pix-border);
    padding-top: .6rem;
    margin-top: .1rem;
}
.ind-future__label {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--pix-text-muted);
    margin-bottom: .4rem;
}
.ind-note--muted {
    margin: .2rem 0 0;
    font-size: .72rem;
    color: var(--pix-text-muted);
    opacity: .8;
}

/* Small screens: tighten header tools */
@media (max-width: 575.98px) {
    .editor-card__reset span { display: none; }   /* icon-only reset on phones */
    .editor-card__header { padding: .7rem .8rem; }
    .editor-card__body { padding: .8rem; }
    .save-badge__text { display: none; }           /* icon-only badge on phones */
    .save-badge { padding: .3rem .4rem; }
}

/* =====================================================================
   Session 4 — live edited-preview canvas
   ===================================================================== */

/* The edited preview frame hosts a canvas rather than an <img>. */
.preview-frame--edited { background: #ffffff; }
.preview-frame__canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
    margin: 0 auto;
    object-fit: contain;
    /* aspect-ratio is set inline by the engine from the frame dimensions */
}

/* Transparency / format warning under the edited canvas */
.trans-warn {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: .55rem 0 0;
    padding: .45rem .6rem;
    border-radius: var(--pix-radius-sm);
    font-size: .74rem;
    font-weight: 600;
}
.trans-warn i { flex: 0 0 auto; }
.trans-warn[data-kind="ok"] {
    background: rgba(15,157,99,.10);
    color: #0f9d63;
    border: 1px solid rgba(15,157,99,.20);
}
.trans-warn[data-kind="warn"] {
    background: rgba(234,179,8,.12);
    color: #a16207;
    border: 1px solid rgba(234,179,8,.28);
}

/* =====================================================================
   Session 5 — interactive canvas (cursors, presets, tools)
   ===================================================================== */

/* Canvas interaction cursors */
.preview-frame__canvas {
    cursor: grab;
    touch-action: none;   /* let pointer events handle drag/pinch */
    outline: none;
}
.preview-frame__canvas:focus-visible {
    /* Inset ring so the keyboard focus indicator is not clipped by the
       parent .preview-frame (overflow: hidden) when the canvas fills it. */
    box-shadow: inset 0 0 0 3px rgba(49,91,255,.55);
    border-radius: 4px;
}
.preview-frame__canvas.is-grabbing { cursor: grabbing; }

/* Edited-preview toolbar (hint + reset position) */
.edited-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .5rem;
    flex-wrap: wrap;
}
.edited-tools__hint {
    font-size: .72rem;
    color: var(--pix-text-muted);
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}
.edited-tools .btn { font-size: .76rem; }

/* Session 12E.3A — compact Original metadata line above the image */
.orig-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem .5rem;
    margin: 0 0 .55rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--pix-text);
}
.orig-meta__label { color: var(--pix-text-muted); font-weight: 600; }
.orig-meta__sep { color: var(--pix-text-muted); opacity: .55; font-weight: 400; }

/* Session 12E.3D/3E — output/transparency status in the card header.
   `display: contents` dissolves the actions wrapper so the Saved/Reset/Remove
   tools stay on the top-right row while the status wraps to its own full-width
   row and is centered across the header. */
.editor-card__actions { display: contents; }
.editor-card__status {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: .3rem;
    flex-basis: 100%;          /* own row, beneath the actions row */
    margin: .1rem 0 0;
    margin-inline: auto;       /* centered across the full header width */
    max-width: fit-content;    /* compact, content-based; wraps within header */
    padding: .18rem .5rem;
    font-size: .72rem;
    line-height: 1.3;
    text-align: center;
}

/* Utility row: guidance + Reset position (transparency notice now in heading) */
.ec-edited-utils {
    margin-top: 0;
    margin-bottom: .5rem;
}

/* Background presets */
.bg-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.bg-preset {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .74rem;
    font-weight: 600;
    color: var(--pix-text);
    background: var(--pix-surface);
    border: 1px solid var(--pix-border);
    border-radius: 999px;
    padding: .28rem .55rem;
    cursor: pointer;
    min-height: 34px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.bg-preset:hover { border-color: var(--pix-blue-2); }
.bg-preset:focus-visible { outline: none; box-shadow: var(--pix-focus); }
/* Disabled presets (native disabled set during processing) must read as
   inactive, not clickable — this custom button is not a Bootstrap .btn. */
.bg-preset:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.bg-preset.is-active {
    border-color: var(--pix-purple);
    box-shadow: 0 0 0 1px var(--pix-purple);
    color: var(--pix-purple);
}
.bg-preset i { font-size: .9rem; }
.bg-preset__sw {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(9,18,37,.18);
    flex: 0 0 auto;
}
.bg-preset__sw--white { background: #ffffff; }
.bg-preset__sw--black { background: #000000; }
.bg-preset__sw--grey  { background: #6b7386; }
.bg-preset__sw--checker {
    background:
        repeating-conic-gradient(#e7ebf5 0% 25%, #ffffff 0% 50%) 50% / 8px 8px;
}

/* Session 8B — compact universal custom-colour swatch (in the presets row). */
.universal-bg-color {
    width: 34px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--pix-border);
    border-radius: 999px;
    background: var(--pix-surface);
    cursor: pointer;
    flex: 0 0 auto;
}
.universal-bg-color::-webkit-color-swatch-wrapper { padding: 0; }
.universal-bg-color::-webkit-color-swatch { border: none; border-radius: 999px; }
.universal-bg-color:focus-visible { outline: none; box-shadow: var(--pix-focus); }

/* =====================================================================
   Session 6 — transform toolbar + crop editor
   ===================================================================== */

/* Transform toolbar (replaces the old disabled future controls) */
.ind-transform {
    border-top: 1px dashed var(--pix-border);
    padding-top: .6rem;
    margin-top: .1rem;
}
.transform-btns {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .4rem;
}
.transform-btn {
    font-size: .76rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 38px;
    min-width: 40px;
    justify-content: center;
}
.transform-btn.is-active {
    border-color: var(--pix-purple);
    color: var(--pix-purple);
    background: var(--pix-gradient-soft);
    box-shadow: inset 0 0 0 1px var(--pix-purple);
}
.transform-btn--reset { margin-left: auto; }

/* ---- Crop editor modal (custom overlay) ---- */
.crop-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(.5rem, 2vw, 1.5rem);
    padding: max(env(safe-area-inset-top, 0px), .5rem)
             max(env(safe-area-inset-right, 0px), .5rem)
             max(env(safe-area-inset-bottom, 0px), .5rem)
             max(env(safe-area-inset-left, 0px), .5rem);
}
.crop-modal[hidden] { display: none; }
.crop-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 14, 28, .72);
    backdrop-filter: blur(2px);
}
.crop-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #0f1523;
    color: #e7ebf5;
    border-radius: var(--pix-radius);
    box-shadow: 0 24px 60px rgba(0,0,0,.5);
    overflow: hidden;
}
.crop-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.crop-modal__head .modal-title { color: #fff; font-weight: 700; font-size: 1rem; margin: 0; }
.crop-modal__head .btn-close {
    filter: invert(1) grayscale(1) brightness(1.6);
    opacity: .8;
}

.crop-modal__presets {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .6rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.crop-preset {
    font-size: .76rem;
    font-weight: 600;
    color: #cdd5e6;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    padding: .3rem .7rem;
    min-height: 34px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.crop-preset:hover { background: rgba(255,255,255,.12); }
.crop-preset:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(123,47,247,.5); }
.crop-preset.is-active {
    background: var(--pix-gradient);
    border-color: transparent;
    color: #fff;
}

.crop-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background:
        radial-gradient(120% 120% at 50% 0%, #141b2c 0%, #0b101b 100%);
    overflow: auto;
}

.crop-stage {
    position: relative;
    line-height: 0;
    touch-action: none;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.crop-stage__canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* The crop selection rectangle */
.crop-rect {
    position: absolute;
    top: 0; left: 0;
    box-sizing: border-box;
    border: 1.5px solid #fff;
    cursor: move;
    touch-action: none;
    outline: none;
    /* Dim everything outside the selection */
    box-shadow: 0 0 0 100vmax rgba(9, 14, 28, .62);
}
.crop-rect:focus-visible { border-color: var(--pix-purple); }
.crop-rect__thirds {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
    background-size: 33.33% 33.33%;
    background-position: 0 0;
    opacity: .5;
}

/* Crop handles */
.crop-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid var(--pix-purple);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
    touch-action: none;
}
/* Enlarge touch target without enlarging the visual */
.crop-handle::after { content: ""; position: absolute; inset: -8px; }
.crop-handle--nw { top: -8px;  left: -8px;  cursor: nwse-resize; }
.crop-handle--ne { top: -8px;  right: -8px; cursor: nesw-resize; }
.crop-handle--se { bottom: -8px; right: -8px; cursor: nwse-resize; }
.crop-handle--sw { bottom: -8px; left: -8px;  cursor: nesw-resize; }
.crop-handle--n  { top: -8px;  left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.crop-handle--s  { bottom: -8px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.crop-handle--w  { left: -8px;  top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.crop-handle--e  { right: -8px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.crop-modal__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-wrap: wrap;
}
.crop-dims {
    font-size: .8rem;
    color: #aeb8cf;
    font-variant-numeric: tabular-nums;
}
.crop-modal__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crop-modal__foot .btn-ghost { color: #cdd5e6; }
.crop-modal__foot .btn-ghost:hover { color: #fff; background: rgba(255,255,255,.08); }
.crop-modal__foot .btn-outline-soft { background: transparent; color: #cdd5e6; border-color: rgba(255,255,255,.18); }
.crop-modal__foot .btn-outline-soft:hover { color: #fff; background: rgba(255,255,255,.08); }

/* Prevent background scroll while cropping */
body.crop-open { overflow: hidden; }

/* Mobile crop layout: keep actions reachable */
@media (max-width: 575.98px) {
    .crop-modal__dialog { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
    .crop-modal__body { padding: .6rem; }
    .crop-modal__foot { position: sticky; bottom: 0; background: #0f1523; }
    .crop-modal__actions { flex: 1 1 auto; justify-content: flex-end; }
}


/* =====================================================================
   Session 7 — developer Render Plan debug panel (hidden unless ?debug=1)
   ===================================================================== */
.render-debug {
    margin-top: .75rem;
    border: 1px dashed var(--pixora-border, #d6ddf0);
    border-radius: 10px;
    background: #0f1729;
    color: #e7ecfb;
    overflow: hidden;
}
.render-debug__summary {
    cursor: pointer;
    list-style: none;
    padding: .5rem .75rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: #aab8e6;
    background: #131c33;
    user-select: none;
}
.render-debug__summary::-webkit-details-marker { display: none; }
.render-debug__summary:hover { color: #dfe6ff; }
.render-debug[open] .render-debug__summary { border-bottom: 1px solid #223055; }
.render-debug__body {
    margin: 0;
    padding: .75rem;
    max-height: 320px;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: .72rem;
    line-height: 1.45;
    white-space: pre;
    tab-size: 2;
    color: #cfe0ff;
}

/* =====================================================================
   Session 10A — Apply processing states, retry, output + progress
   ===================================================================== */

/* Per-card processing status pill (reuses the header status element). */
.editor-card__status { display: inline-flex; align-items: center; gap: .3rem; }
.editor-card__status.is-uploaded,
.editor-card__status.is-completed { color: #0f9d63; }
.editor-card__status.is-queued    { color: var(--pix-text-muted); }
.editor-card__status.is-pending   { color: #a16207; }
.editor-card__status.is-processing { color: var(--pix-blue); }
.editor-card__status.is-stale     { color: #a16207; }
.editor-card__status.is-failed    { color: #b42318; }
.editor-card__status.is-skipped   { color: var(--pix-text-muted); }
.editor-card__status.is-processing i { animation: pix-spin .8s linear infinite; }

/* Converted-output summary line (safe metadata only). */
.proc-output {
    margin: .3rem 0 0;
    font-size: .74rem;
    font-weight: 600;
    color: var(--pix-blue);
    font-variant-numeric: tabular-nums;
}
.proc-output[hidden] { display: none; }

/* Retry button in the card tools. */
.proc-retry { font-size: .74rem; }
.proc-retry[hidden] { display: none; }

/* Session 10B — Download button reuses the existing button styling and mirrors
   the Retry sizing / hidden handling (no redesign). */
.proc-download { font-size: .74rem; }
.proc-download[hidden] { display: none; }

/* While a queue (or a card retry) runs, block canvas manipulation. */
body.is-processing .preview-frame__canvas,
.image-card.is-proc-locked .preview-frame__canvas {
    pointer-events: none;
    cursor: not-allowed;
}
body.is-processing .dropzone.is-disabled { cursor: not-allowed; }

/* Progress modal additions. */
.progress-current { font-weight: 600; color: var(--pix-text); margin: 0; }
.progress-filename {
    font-size: .8rem;
    color: var(--pix-text-muted);
    max-width: 100%;
}
.progress-filename:empty { display: none; }

.progress-counts {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: .5rem;
    font-size: .8rem;
    font-weight: 600;
}
.proc-count { display: inline-flex; align-items: center; gap: .3rem; }
.proc-count--ok    { color: #0f9d63; }
.proc-count--fail  { color: #b42318; }
.proc-count--stale { color: #a16207; }

.progress-done {
    margin-top: .85rem;
    padding: .65rem .75rem;
    border-radius: var(--pix-radius-sm);
    background: var(--pix-gradient-soft);
    border: 1px solid var(--pix-border);
}
.progress-done[hidden] { display: none; }
.progress-done__title { font-weight: 700; color: var(--pix-text); }
.progress-done__sub {
    font-size: .8rem;
    color: var(--pix-text-muted);
    font-variant-numeric: tabular-nums;
}
