:root {
    --bg: #101314;
    --panel: #171d1c;
    --panel-2: #202826;
    --line: rgba(255,255,255,.12);
    --text: #f4f7f1;
    --muted: #9aa8a0;
    --green: #21c48d;
    --green-2: #99f6cf;
    --cyan: #67e8f9;
    --amber: #f2c15d;
    --red: #fb7185;
}

* { box-sizing: border-box; }
html {
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 12%, rgba(33,196,141,.14), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,.03), transparent 38%),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.image-workbench-app {
    width: min(1480px, calc(100vw - 28px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.workbench-topbar,
.panel-head,
.topbar-actions,
.result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.workbench-topbar {
    min-height: 72px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--green-2);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

h1, h2, h3 { margin: 0; font-weight: 850; }
h1 { font-size: 30px; }
h2 { font-size: 19px; }
h3 { font-size: 18px; }
.topbar-meta,
.field-hint {
    color: var(--muted);
    font-size: 13px;
}

.topbar-logout-form {
    margin: 0;
}

.image-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.image-auth-panel {
    width: min(460px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(23,29,28,.94);
    box-shadow: 0 22px 80px rgba(0,0,0,.32);
}

.image-auth-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border: 1px solid rgba(153,246,207,.34);
    border-radius: 8px;
    color: var(--green-2);
    background: rgba(33,196,141,.12);
    font-size: 26px;
}

.image-auth-panel h1 {
    margin-bottom: 8px;
}

.image-auth-panel p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.7;
}

.image-auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 14px;
}

.image-auth-links a {
    color: var(--green-2);
    text-decoration: none;
}

.image-auth-links a:hover {
    text-decoration: underline;
}

.workbench-grid {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.request-panel,
.result-panel,
.history-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(23,29,28,.92);
    box-shadow: 0 22px 80px rgba(0,0,0,.28);
}

.request-panel,
.result-panel {
    padding: 18px;
}

.request-panel {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow: auto;
    scrollbar-gutter: stable;
}

.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 16px 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
}

.mode-toggle button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.mode-toggle button.active {
    background: rgba(33,196,141,.18);
    color: var(--green-2);
}

.form-section {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.form-section label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
}

.section-title {
    color: var(--green-2);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.section-title.with-help {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-badge {
    position: relative;
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(153,246,207,.42);
    border-radius: 999px;
    color: var(--green-2);
    background: rgba(153,246,207,.08);
    cursor: help;
}

.info-badge i {
    font-size: 12px;
}

.info-popover {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    z-index: 5;
    width: min(320px, calc(100vw - 42px));
    padding: 10px 12px;
    border: 1px solid rgba(153,246,207,.28);
    border-radius: 8px;
    background: rgba(12,18,17,.98);
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.55;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: 0 18px 50px rgba(0,0,0,.45);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 6px);
    transition: opacity .16s ease, transform .16s ease;
}

.info-badge:hover .info-popover,
.info-badge:focus .info-popover {
    opacity: 1;
    transform: translate(-50%, 0);
}

.compact-grid {
    grid-template-columns: 1fr 1fr;
}

.compact-grid label:first-child,
.compact-grid label:nth-child(2),
.compact-grid label:last-child {
    grid-column: span 1;
}

.form-control,
.form-select {
    min-height: 42px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    background-color: #111615;
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(33,196,141,.72);
    box-shadow: 0 0 0 .2rem rgba(33,196,141,.13);
}

.manual-credential-options {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    background: rgba(255,255,255,.035);
}

.manual-remember-option {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-weight: 850;
}

.manual-remember-option .form-check-input {
    margin: 0;
}

.size-picker-section {
    padding: 12px;
    border: 1px solid rgba(153,246,207,.14);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(103,232,249,.06), transparent 42%),
        rgba(255,255,255,.025);
}

.size-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
}

.size-output-text {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border: 1px solid rgba(103,232,249,.26);
    border-radius: 999px;
    color: var(--cyan);
    background: rgba(103,232,249,.08);
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.size-level-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.size-level-option,
.aspect-ratio-option,
.run-range-chip {
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 8px;
    background: rgba(0,0,0,.18);
    color: var(--muted);
    font-weight: 850;
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}

.size-level-option {
    min-height: 40px;
}

.size-level-option:hover,
.aspect-ratio-option:hover,
.run-range-chip:hover {
    border-color: rgba(153,246,207,.34);
    color: var(--text);
    transform: translateY(-1px);
}

.size-level-option.active,
.aspect-ratio-option.active,
.run-range-chip.active {
    border-color: rgba(153,246,207,.62);
    background: rgba(33,196,141,.16);
    color: var(--green-2);
    box-shadow: inset 0 0 0 1px rgba(153,246,207,.1), 0 10px 26px rgba(33,196,141,.08);
}

.aspect-ratio-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.aspect-ratio-option {
    min-height: 62px;
    display: grid;
    place-items: center;
    gap: 5px;
    padding: 7px 4px;
    font-size: 12px;
}

.ratio-glyph {
    position: relative;
    display: block;
    width: 30px;
    height: 22px;
    border: 1px solid currentColor;
    border-radius: 4px;
    opacity: .9;
}

.ratio-glyph.is-square {
    width: 24px;
    height: 24px;
}

.ratio-glyph.is-portrait {
    width: 20px;
    height: 30px;
}

.ratio-glyph.is-auto {
    width: auto;
    height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    font-size: 10px;
    line-height: 1;
    text-transform: uppercase;
}

.custom-size-toggle {
    display: inline-flex !important;
    grid-auto-flow: column;
    align-items: center;
    justify-content: start;
    gap: 8px !important;
    color: var(--muted) !important;
}

.custom-size-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--green);
}

.custom-size-panel {
    display: grid;
    gap: 6px;
}

.prompt-input {
    min-height: 140px;
    resize: vertical;
}

.upload-zone {
    min-height: 120px;
    display: grid;
    place-items: center;
    gap: 8px;
    border: 1px dashed rgba(153,246,207,.45);
    border-radius: 8px;
    background: rgba(33,196,141,.07);
    cursor: pointer;
}

.upload-zone input { display: none; }
.upload-zone i {
    color: var(--green-2);
    font-size: 30px;
}

.input-preview {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: rgba(0,0,0,.18);
}

.input-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.input-preview-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 7px;
    background: #0b0e0d;
    cursor: grab;
}

.input-preview-item.is-dragging {
    opacity: .55;
    outline: 2px solid rgba(103,232,249,.5);
}

.input-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.input-preview-shade {
    position: absolute;
    inset: auto 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.78));
}

.input-preview-shade span {
    min-width: 0;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(17,22,21,.78);
    color: var(--green-2);
    font-size: 11px;
    font-weight: 850;
}

.input-remove {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    background: rgba(17,22,21,.82);
    color: var(--text);
}

.submit-button {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    font-weight: 850;
    background: var(--green);
    border-color: var(--green);
}

.ws-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.ws-status.is-online {
    border-color: rgba(33,196,141,.38);
    background: rgba(33,196,141,.13);
    color: var(--green-2);
}

.ws-status.is-offline {
    border-color: rgba(251,113,133,.36);
    background: rgba(251,113,133,.12);
    color: var(--red);
}

.result-stage {
    min-height: 560px;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(153,246,207,.32);
    border-radius: 8px;
    background:
        radial-gradient(circle at 78% 18%, rgba(103,232,249,.08), transparent 26%),
        linear-gradient(135deg, rgba(255,255,255,.03), rgba(33,196,141,.06)),
        rgba(255,255,255,.02);
    overflow: hidden;
    position: relative;
}

.empty-result {
    max-width: 360px;
    text-align: center;
    color: var(--muted);
}

.empty-result.is-error .empty-mark {
    background: rgba(251,113,133,.15);
    color: var(--red);
}

.empty-mark {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    border-radius: 8px;
    background: rgba(33,196,141,.16);
    color: var(--green-2);
    font-size: 30px;
}

.loading-result {
    position: relative;
    width: min(520px, calc(100% - 28px));
    display: grid;
    justify-items: center;
    gap: 16px;
    padding: 34px 18px;
    text-align: center;
    isolation: isolate;
}

.loading-result::before {
    content: "";
    position: absolute;
    inset: -120px;
    background:
        linear-gradient(90deg, transparent, rgba(153,246,207,.14), transparent),
        repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 36px),
        repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 1px, transparent 1px 36px);
    animation: stageScan 3.2s linear infinite;
}

.tech-loading {
    width: min(620px, calc(100% - 24px));
    padding: 38px 22px;
    border: 1px solid rgba(103,232,249,.22);
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 32%, rgba(103,232,249,.14), transparent 34%),
        linear-gradient(180deg, rgba(7,16,18,.94), rgba(12,18,17,.88));
    box-shadow: 0 0 0 1px rgba(153,246,207,.08), 0 34px 90px rgba(0,0,0,.38);
    overflow: hidden;
}

.tech-loading::before {
    opacity: .58;
    mix-blend-mode: screen;
}

.tech-grid,
.tech-scanline {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.tech-grid {
    background:
        linear-gradient(rgba(103,232,249,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(103,232,249,.06) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}

.tech-scanline {
    height: 46%;
    background: linear-gradient(180deg, transparent, rgba(153,246,207,.13), transparent);
    animation: verticalScan 2.8s ease-in-out infinite;
}

.loading-status-chip {
    position: relative;
    z-index: 1;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid rgba(242,193,93,.34);
    border-radius: 999px;
    color: var(--amber);
    background: rgba(242,193,93,.11);
    font-size: 12px;
    font-weight: 900;
}

.loading-result.is-running .loading-status-chip {
    border-color: rgba(103,232,249,.38);
    color: var(--cyan);
    background: rgba(103,232,249,.1);
}

.loading-visual,
.loading-copy,
.loading-meter {
    position: relative;
    z-index: 1;
}

.loading-visual {
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: var(--green-2);
    background: rgba(33,196,141,.12);
    box-shadow: 0 0 0 1px rgba(153,246,207,.22), 0 0 80px rgba(33,196,141,.25);
}

.loading-visual span {
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(153,246,207,.32);
    border-radius: 16px;
    animation: pulseRing 2.4s ease-in-out infinite;
}

.loading-visual span:nth-child(2) {
    inset: 24px;
    border-color: rgba(103,232,249,.26);
    animation-delay: .35s;
}

.loading-visual span:nth-child(3) {
    inset: 36px;
    border-color: rgba(242,193,93,.22);
    animation-delay: .7s;
}

.loading-visual i {
    font-size: 34px;
    animation: starFloat 1.9s ease-in-out infinite;
}

.loading-kicker {
    color: var(--amber);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
}

.loading-copy h3 {
    margin-top: 8px;
}

.loading-copy p {
    margin: 8px auto 0;
    color: var(--muted);
}

.loading-meter {
    min-width: 170px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 13px;
    border: 1px solid rgba(153,246,207,.24);
    border-radius: 999px;
    background: rgba(0,0,0,.18);
}

.loading-meter.secondary {
    justify-content: center;
    border-color: rgba(103,232,249,.24);
}

.loading-meter.secondary strong {
    color: var(--cyan);
}

.loading-meter span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.loading-meter strong {
    color: var(--green-2);
    font-variant-numeric: tabular-nums;
}

.queue-progress {
    position: relative;
    z-index: 1;
    width: min(390px, 100%);
    display: grid;
    gap: 8px;
}

.queue-progress-line {
    position: relative;
    height: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    background: rgba(0,0,0,.28);
}

.queue-progress-line span {
    position: absolute;
    inset: 0 auto 0 0;
    min-width: 18%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--amber), var(--cyan), var(--green-2));
    box-shadow: 0 0 20px rgba(103,232,249,.35);
}

.queue-progress.is-indeterminate .queue-progress-line span {
    width: 42%;
    animation: queueSweep 1.55s ease-in-out infinite;
}

.queue-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.background-job-button {
    position: relative;
    z-index: 1;
    min-height: 38px;
    padding-inline: 16px;
    border-color: rgba(103,232,249,.32);
    color: var(--cyan);
    background: rgba(103,232,249,.08);
    font-weight: 850;
}

.background-job-button:hover {
    border-color: rgba(103,232,249,.58);
    background: rgba(103,232,249,.14);
    color: var(--text);
}

.result-gallery-shell {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px;
    animation: resultReveal .28s ease-out both;
}

.result-main-frame {
    min-height: 430px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(0,0,0,.14);
    position: relative;
}

.result-main-frame.is-switching::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(90deg, transparent, rgba(153,246,207,.08), transparent),
        rgba(7,12,11,.36);
    animation: resultImageSweep 1.15s ease-in-out infinite;
    pointer-events: none;
}

.result-image-pending {
    width: min(380px, calc(100% - 32px));
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 28px 18px;
    text-align: center;
    color: var(--muted);
}

.result-image-pending .empty-mark {
    margin-bottom: 4px;
}

.result-image-pending h3 {
    margin: 0;
    color: var(--text);
}

.result-image-pending p {
    margin: 0;
}

.pending-image-meta {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 11px;
    border: 1px solid rgba(103,232,249,.24);
    border-radius: 999px;
    background: rgba(103,232,249,.08);
    color: var(--cyan);
    font-size: 12px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}

.result-image {
    width: 100%;
    height: 100%;
    max-height: 650px;
    object-fit: contain;
    display: block;
}

.result-image-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
    display: grid;
    place-items: center;
}

.result-image-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    place-items: center;
    gap: 8px;
    color: var(--green-2);
    font-size: 12px;
    font-weight: 850;
    background: rgba(7,12,11,.34);
}

.result-image-wrap.is-loading .result-image-loading {
    display: inline-grid;
    grid-auto-flow: column;
}

.result-image-load-error {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: rgba(11,14,13,.92);
    color: var(--muted);
}

.result-image-wrap.is-broken .result-image-load-error {
    display: grid;
}

.result-image-load-error i {
    color: var(--red);
    font-size: 34px;
}

.result-image-load-error h3 {
    color: var(--text);
}

.result-image-load-error .btn {
    min-width: 112px;
}

.image-error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.result-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

.result-thumb {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    background: rgba(0,0,0,.24);
    color: var(--text);
    padding: 0;
}

.result-thumb.active {
    border-color: rgba(153,246,207,.82);
    box-shadow: 0 0 0 2px rgba(33,196,141,.2);
}

.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.result-thumb > span {
    position: absolute;
    right: 6px;
    bottom: 6px;
    min-width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(10,14,13,.82);
    color: var(--green-2);
    font-size: 12px;
    font-weight: 900;
}

.result-thumb.is-broken {
    display: grid;
    place-items: center;
    gap: 6px;
    padding: 8px;
    color: var(--red);
    font-size: 12px;
}

.result-image-error {
    max-width: 360px;
    text-align: center;
    color: var(--muted);
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 24px;
}

.result-image-error i {
    color: var(--red);
    font-size: 36px;
}

.result-image-error h3,
.result-image-error p {
    margin: 0;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.result-meta span {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.result-actions {
    justify-content: stretch;
    margin-top: 10px;
}

.result-actions .btn {
    flex: 1 1 0;
    min-height: 42px;
}

.history-panel {
    margin-top: 18px;
    padding: 14px;
    box-shadow: none;
}

.panel-head.slim {
    margin-bottom: 10px;
}

.run-filter-bar {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    background: rgba(0,0,0,.13);
}

.run-quick-ranges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.run-range-chip {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12px;
}

.run-date-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr)) auto;
    gap: 8px;
    align-items: end;
}

.run-date-fields label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
}

.run-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.run-pager span {
    text-align: center;
}

.run-list-frame {
    position: relative;
    min-height: 360px;
    max-height: clamp(360px, 46vh, 560px);
    overflow: auto;
    padding-right: 2px;
    scrollbar-gutter: stable;
}

.run-list {
    display: grid;
    gap: 8px;
}

.run-list-loading {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: start center;
    padding-top: 72px;
    background: linear-gradient(180deg, rgba(12,18,17,.76), rgba(12,18,17,.42));
    backdrop-filter: blur(4px);
}

.run-list-loading-panel {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 13px;
    border: 1px solid rgba(153,246,207,.28);
    border-radius: 999px;
    color: var(--green-2);
    background: rgba(8,12,11,.84);
    box-shadow: 0 16px 40px rgba(0,0,0,.32);
    font-size: 12px;
    font-weight: 850;
}

.run-list-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(153,246,207,.26);
    border-top-color: var(--green-2);
    border-radius: 999px;
    animation: spin .72s linear infinite;
}

.run-list-frame.is-loading .run-list {
    pointer-events: none;
}

.run-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 64px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.035);
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.run-item:hover {
    border-color: rgba(153,246,207,.32);
    background: rgba(153,246,207,.055);
    transform: translateY(-1px);
}

.run-item.is-running,
.run-item.is-queued {
    border-color: rgba(242,193,93,.24);
    background:
        linear-gradient(90deg, rgba(242,193,93,.08), transparent 62%),
        rgba(255,255,255,.035);
}

.run-item.is-failed,
.run-item.is-stale {
    border-color: rgba(251,113,133,.24);
}

.run-item-body {
    min-width: 0;
}

.run-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.run-item-title {
    min-width: 0;
    font-weight: 850;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-item-meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.run-prompt {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid rgba(153,246,207,.14);
    border-radius: 7px;
    background: rgba(0,0,0,.16);
}

.run-prompt-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--green-2);
    font-size: 11px;
    font-weight: 900;
}

.run-prompt-label button {
    margin-left: auto;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 900;
}

.run-prompt-text {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.run-item-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.run-item-extra span {
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.run-state-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.run-state-badge.is-completed {
    border-color: rgba(33,196,141,.36);
    background: rgba(33,196,141,.12);
    color: var(--green-2);
}

.run-state-badge.is-running,
.run-state-badge.is-queued {
    border-color: rgba(242,193,93,.34);
    background: rgba(242,193,93,.12);
    color: var(--amber);
}

.run-state-badge.is-failed,
.run-state-badge.is-stale {
    border-color: rgba(251,113,133,.34);
    background: rgba(251,113,133,.12);
    color: var(--red);
}

.run-progress-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 rgba(242,193,93,.2);
    animation: queuePulse 1.35s ease-out infinite;
}

.run-thumb {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 6px;
    object-fit: cover;
    background: #0b0e0d;
}

.run-thumb.is-empty {
    color: var(--muted);
}

.run-thumb.is-live {
    position: relative;
    overflow: hidden;
    color: var(--amber);
    background:
        radial-gradient(circle at 50% 50%, rgba(242,193,93,.24), transparent 62%),
        #0b0e0d;
}

.run-thumb.is-live i {
    position: relative;
    z-index: 1;
    animation: starFloat 1.8s ease-in-out infinite;
}

.run-live-orbit {
    position: absolute;
    inset: 9px;
    border: 1px solid rgba(242,193,93,.42);
    border-radius: 999px;
    animation: liveOrbit 1.6s linear infinite;
}

.run-live-orbit::after {
    content: "";
    position: absolute;
    right: -3px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--amber);
    box-shadow: 0 0 16px rgba(242,193,93,.8);
}

.run-thumb.is-error {
    color: var(--red);
    background: rgba(251,113,133,.12);
}

.run-thumb.is-load-error {
    opacity: .32;
    border: 1px solid rgba(251,113,133,.28);
}

.workbench-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    max-width: min(420px, calc(100vw - 44px));
    padding: 12px 14px;
    border: 1px solid rgba(33,196,141,.32);
    border-radius: 8px;
    background: rgba(17,22,21,.96);
    color: var(--text);
    box-shadow: 0 18px 60px rgba(0,0,0,.38);
}

[hidden] { display: none !important; }

@keyframes stageScan {
    0% { transform: translateX(-12%) translateY(-4%); }
    100% { transform: translateX(12%) translateY(4%); }
}

@keyframes pulseRing {
    0%, 100% { opacity: .38; transform: scale(.94) rotate(0deg); }
    50% { opacity: .95; transform: scale(1.08) rotate(8deg); }
}

@keyframes starFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.06); }
}

@keyframes resultReveal {
    from { opacity: 0; transform: translateY(8px) scale(.992); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes resultImageSweep {
    0% { background-position: -180px 0, 0 0; opacity: .52; }
    50% { opacity: .78; }
    100% { background-position: 180px 0, 0 0; opacity: .52; }
}

@keyframes queuePulse {
    0% { box-shadow: 0 0 0 0 rgba(242,193,93,.38); }
    100% { box-shadow: 0 0 0 8px rgba(242,193,93,0); }
}

@keyframes liveOrbit {
    to { transform: rotate(360deg); }
}

@keyframes verticalScan {
    0% { transform: translateY(-110%); opacity: 0; }
    18%, 80% { opacity: 1; }
    100% { transform: translateY(160%); opacity: 0; }
}

@keyframes queueSweep {
    0% { transform: translateX(-70%); }
    50% { transform: translateX(70%); }
    100% { transform: translateX(230%); }
}

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

@media (max-width: 980px) {
    .image-workbench-app {
        width: min(100vw - 18px, 760px);
        padding-top: 12px;
    }
    .workbench-topbar,
    .topbar-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .workbench-grid {
        grid-template-columns: 1fr;
    }
    .request-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }
    .result-stage {
        min-height: 380px;
    }
    .result-main-frame {
        min-height: 300px;
    }
    .result-actions {
        flex-direction: column;
    }
    .run-date-fields {
        grid-template-columns: 1fr 1fr;
    }
    .run-list-frame {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 560px) {
    h1 { font-size: 24px; }
    .compact-grid {
        grid-template-columns: 1fr;
    }
    .size-picker-head,
    .queue-progress-meta,
    .run-pager {
        align-items: stretch;
        flex-direction: column;
    }
    .size-level-picker,
    .aspect-ratio-picker,
    .run-date-fields {
        grid-template-columns: 1fr 1fr;
    }
    .run-item {
        grid-template-columns: 1fr;
    }
    .run-thumb {
        width: 100%;
        height: 160px;
    }
    .input-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .result-thumb-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
