:root {
    /* Design System Variables — Emerald Green Theme */
    --bg-slate-900: #111a2e;
    --bg-slate-950: #0a1020;
    --text-slate-50: #f7f9ff;
    --text-slate-400: #aab7d4;

    /* Accent: Emerald Green */
    --emerald-400: #78c7ff;
    --emerald-500: #4aa8ff;
    --emerald-600: #2f8fe8;
    --emerald-700: #2474bd;
    --teal-400: #55d9f8;
    --amber-500: #ffc857;
    --rose-500: #ff7189;

    /* Semantic Variables */
    --bg: var(--bg-slate-900);
    --surface-base: var(--bg-slate-950);
    --surface-raised: var(--bg-slate-900);
    --text-primary: var(--text-slate-50);
    --text-secondary: var(--text-slate-400);

    /* Main accent is now green */
    --accent-primary: var(--emerald-500);
    --accent-primary-glow: rgba(74, 168, 255, 0.18);
    --accent-purple: var(--accent-primary);
    --accent-purple-glow: var(--accent-primary-glow);
    --accent-hover: var(--emerald-600);
    --accent-sky: var(--teal-400);

    --border-subtle: #1a3328;
    --border-hover: #2d5040;

    --info: var(--teal-400);
    --success: #7ed957;
    --warning: var(--amber-500);
    --danger: var(--rose-500);
    --like-color: #66b8ff;
    --dislike-color: #ff7189;

    --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

    --sans-display: var(--font-sans);
    --sans-text: var(--font-sans);
    --mono: var(--font-mono);

    --radius-bento: 12px;
    --radius-inner: 8px;
    --radius-control: 6px;
    --radius-badge: 999px;

    --transition-snappy: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slide: all 300ms cubic-bezier(0.4, 0, 0.2, 1);

    --shadow-default: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 10px 15px -3px rgba(74, 168, 255, 0.2), 0 4px 6px -4px rgba(74, 168, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: var(--sans-text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    padding: 40px 24px 60px 24px;
    overflow-y: scroll;
    position: relative;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: var(--radius-badge);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--emerald-600);
}

/* Spotlight Top Ambient Glow */
.spotlight-banner {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1400px;
    height: 400px;
    background-image: radial-gradient(circle at top, rgba(74, 168, 255, 0.12) 0%, transparent 60%);
    z-index: 0;
    pointer-events: none;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    z-index: 1;
}

/* Sticky Navigation Bar */
.nav-bar {
    position: sticky;
    top: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(2, 6, 23, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-bento);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--emerald-400);
    filter: drop-shadow(0 0 8px rgba(120, 199, 255, 0.45));
}


.logo-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.logo-text h1 {
    font-family: var(--sans-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.version-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: var(--radius-badge);
}

.status-panel {
    display: flex;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    transition: var(--transition-snappy);
}

.status-online::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-busy::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

.status-offline::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

/* Main Workspace Layout */
.workspace-layout {
    display: grid;
    grid-template-columns: minmax(380px, 1.15fr) minmax(340px, 0.85fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .workspace-layout {
        grid-template-columns: 1fr;
    }
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Bento Card Styles */
.bento-card {
    background-color: var(--surface-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-bento);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition-snappy);
}

.bento-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.header-title h2 {
    font-family: var(--sans-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-header .icon {
    color: var(--text-secondary);
}

.bento-card:hover .card-header .icon {
    color: var(--emerald-400);
}

.card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Micro Badge */
.micro-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--emerald-400);
    background: rgba(120, 199, 255, 0.08);
    border: 1px solid rgba(120, 199, 255, 0.2);
    padding: 3px 8px;
    border-radius: var(--radius-badge);
}


/* Form Styles */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

textarea {
    width: 100%;
    height: 180px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-inner);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: var(--sans-text);
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: var(--transition-snappy);
}

textarea:focus {
    border-color: var(--emerald-500);
    background: rgba(74, 168, 255, 0.02);
    box-shadow: 0 0 20px rgba(74, 168, 255, 0.1);
}


/* Config Pane */
.config-pane {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-inner);
    padding: 18px;
}

.config-pane h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

select, input[type="number"] {
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-control);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--sans-text);
    font-size: 13px;
    outline: none;
    transition: var(--transition-snappy);
}

select:focus, input[type="number"]:focus {
    border-color: var(--emerald-500);
    box-shadow: 0 0 10px rgba(74, 168, 255, 0.1);
}

/* Button UI Controls */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    font-family: var(--sans-text);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-control);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-snappy);
    white-space: nowrap;
}


.primary-btn {
    background: linear-gradient(135deg, var(--emerald-500) 0%, var(--emerald-600) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(74, 168, 255, 0.3);
}

.primary-btn:hover {
    background: linear-gradient(135deg, var(--emerald-400) 0%, var(--emerald-500) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(74, 168, 255, 0.45);
}

.primary-btn:active {
    transform: translateY(0);
}


.secondary-btn {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

/* Queue Container */
.queue-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 380px;
}

.queue-header-row {
    display: flex;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.01);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--sans-text);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.queue-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-height: 520px;
}


.queue-row {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition-snappy);
    flex-shrink: 0;
    position: relative; /* necessary for progress bar absolute positioning at bottom */
}

.queue-row:hover {
    background: rgba(255, 255, 255, 0.01);
}

.queue-row.generating {
    background: rgba(74, 168, 255, 0.04);
    border-left: 2px solid var(--emerald-500);
}

.col-num { width: 36px; font-weight: 600; color: var(--text-secondary); }
.col-prompt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 12px; font-size: 13px; }
.col-status { width: 110px; }
.col-time { width: 60px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 12px; font-family: var(--mono); }

/* Badges for status */
.q-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-badge);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-pending { background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); }
.badge-generating { background: rgba(74, 168, 255, 0.15); color: var(--emerald-400); animation: breath 2s infinite ease-in-out; }
.badge-completed { background: rgba(120, 199, 255, 0.12); color: var(--emerald-400); }
.badge-failed { background: rgba(244, 63, 94, 0.1); color: var(--danger); }
.badge-skipped { background: rgba(245, 158, 11, 0.1); color: var(--warning); }


/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 36px 24px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* System Logs Panel */
.logs-panel {
    flex: 1;
}

.log-container {
    padding: 12px;
}

.log-window {
    background-color: #020306;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-inner);
    padding: 14px;
    height: 180px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.log-entry {
    word-break: break-all;
    white-space: pre-wrap;
}

.log-entry .log-time {
    color: #4b5563;
    margin-right: 8px;
    font-weight: 500;
}

.log-entry.system { color: #52a8ff; }
.log-entry.queue { color: #b794f4; }
.log-entry.active { color: #f6ad55; }
.log-entry.server { color: var(--success); }
.log-entry.error { color: var(--danger); }

.btn-clear-logs {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-badge);
    transition: var(--transition-snappy);
    padding: 0;
}

.btn-clear-logs:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Queue Header Controls & Status badges */
.header-left-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.queue-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctrl-btn {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: var(--radius-badge);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-snappy);
    padding: 0;
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.ctrl-btn.danger:hover {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
    border-color: rgba(244, 67, 54, 0.2);
}

.badge-status {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-badge);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
}

.badge-idle {
    background: rgba(148, 163, 184, 0.04);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.badge-running {
    background: rgba(76, 173, 107, 0.08);
    color: var(--success);
    border-color: rgba(76, 173, 107, 0.15);
    animation: breath 2s infinite ease-in-out;
}

.badge-paused {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.15);
}

/* Gallery Bento Section */
.gallery-section {
    margin-top: 24px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
}

.gallery-card {
    background: var(--surface-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-inner);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    transition: var(--transition-snappy);
    position: relative;
}

.gallery-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-glow);
}

.img-wrapper {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    background: #010206;
}

.img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-snappy);
}

.gallery-card:hover .img-wrapper img {
    transform: scale(1.04);
}

.card-meta {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.card-prompt {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    height: 2.8em;
}

.card-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--sans-text);
}

/* Lightbox View Overlay */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 2, 18, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.lightbox-content {
    background: var(--surface-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-bento);
    max-width: 960px;
    width: 100%;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
    position: relative;
    overflow: hidden;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 2.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-snappy);
    z-index: 10;
}

.lightbox-close:hover {
    color: var(--text-primary);
}

.lightbox-body {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
}

@media (max-width: 768px) {
    .lightbox-body {
        grid-template-columns: 1fr;
    }
}

.lightbox-image-container {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    position: relative;
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-snappy);
    z-index: 5;
    outline: none;
}

.lightbox-nav-btn:hover {
    background: rgba(74, 168, 255, 0.85);
    color: #fff;
    border-color: var(--emerald-500);
    box-shadow: 0 0 15px rgba(74, 168, 255, 0.5);
}


.lightbox-nav-btn:disabled {
    opacity: 0.15;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.2);
    border-color: transparent;
    color: var(--text-secondary);
    box-shadow: none;
}

.lightbox-nav-btn.prev-btn {
    left: 16px;
}

.lightbox-nav-btn.next-btn {
    right: 16px;
}


.lightbox-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-meta {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.lightbox-meta h3 {
    font-family: var(--sans-display);
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-item strong {
    font-size: 12px;
    color: var(--text-secondary);
}

.meta-item p {
    font-size: 13px;
    line-height: 1.6;
}

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.download-btn {
    margin-top: auto;
}

/* Animations */
@keyframes breath {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.gallery-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.gallery-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-right: auto; /* push action buttons to the right */
}


/* Parameter Descriptions */
.field-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
    margin-top: 4px;
}

/* Language Switcher */
.lang-toggle-btn {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 50px;
    margin-right: 12px;
    transition: var(--transition-snappy);
    outline: none;
}

.lang-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.github-repo-btn {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 50px;
    margin-right: 10px;
    transition: var(--transition-snappy);
    outline: none;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.github-repo-btn:hover {
    background: rgba(120, 199, 255, 0.08);
    color: var(--emerald-400);
    border-color: rgba(120, 199, 255, 0.35);
}

/* Restart Server Button */
.restart-server-btn {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 50px;
    margin-right: 10px;
    transition: var(--transition-snappy);
    outline: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.restart-server-btn:hover {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.35);
}

.restart-server-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.restart-server-btn.restarting svg {
    animation: spin 1s linear infinite;
}

/* Stop Server Button */
.stop-server-btn {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 50px;
    margin-right: 10px;
    transition: var(--transition-snappy);
    outline: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stop-server-btn:hover {
    background: rgba(244, 63, 94, 0.08);
    color: var(--danger);
    border-color: rgba(244, 63, 94, 0.35);
}

.stop-server-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

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


/* Prompt History Section */
.prompt-history-section {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-inner);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 140px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-clear-history {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition-snappy);
    padding: 2px;
}

.btn-clear-history:hover {
    color: var(--danger);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.history-item {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 6px 10px;
    color: var(--text-primary);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: var(--transition-snappy);
    text-align: left;
    flex-shrink: 0;
}

.history-item:hover {
    background: rgba(74, 168, 255, 0.07);
    border-color: rgba(120, 199, 255, 0.3);
    color: var(--emerald-400);
}


.history-empty {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px 0;
    font-style: italic;
}

/* Queue Progress Bar Component */
.queue-progress-container {
    padding: 16px 24px 8px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.005);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.progress-label {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-value {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--emerald-400);
}

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-badge);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--emerald-600) 0%, var(--emerald-400) 100%);
    box-shadow: 0 0 8px rgba(120, 199, 255, 0.6);
    width: 0%;
    border-radius: var(--radius-badge);
    transition: none;
}

/* Lightbox Actions Container */
.lightbox-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    width: 100%;
}

.lightbox-actions .btn {
    flex: 1;
    margin: 0;
    padding: 10px 12px;
    font-size: 12px;
}

/* Gallery Group Card Styling */
.gallery-group-card {
    background: var(--surface-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-inner);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    transition: var(--transition-snappy);
    grid-column: span 1;
}

.gallery-group-card:hover {
    border-color: var(--emerald-600);
    box-shadow: var(--shadow-glow);
}

.gallery-group-card.multi-versions {
    grid-column: span 2;
}

.group-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.01);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.group-prompt {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.btn-regenerate-group {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    transition: var(--transition-snappy);
    padding: 0;
}

.btn-regenerate-group:hover {
    color: var(--emerald-400);
    background: rgba(120, 199, 255, 0.1);
}


.group-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.1);
    flex: 1;
}

.group-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: #010206;
    cursor: pointer;
    transition: var(--transition-snappy);
}

.group-image-item:hover {
    transform: scale(1.02);
    border-color: var(--emerald-500);
}

.group-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-meta-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transition: opacity 200ms ease;
}

.group-image-item:hover .image-meta-overlay {
    opacity: 1;
}

.image-seed-badge {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: var(--mono);
}

.btn-regenerate-single {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    transition: var(--transition-snappy);
    padding: 0;
}

.btn-regenerate-single:hover {
    color: var(--emerald-400);
    background: rgba(255, 255, 255, 0.1);
}

/* Total Timer Display */
.total-timer {
    font-size: 11px;
    font-weight: 700;
    color: var(--emerald-400);
    background: rgba(120, 199, 255, 0.08);
    border: 1px solid rgba(120, 199, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-variant-numeric: tabular-nums;
    font-family: var(--mono);
    display: inline-block;
}


/* Right Side Logs Drawer */
.logs-drawer {
    position: fixed;
    top: 0;
    right: -380px; /* Hidden off-screen by default */
    width: 380px;
    height: 100vh;
    background: rgba(2, 6, 23, 0.98);
    border-left: 1px solid var(--border-subtle);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    z-index: 900;
    transition: right 400ms cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.logs-drawer.expanded {
    right: 0;
}


.drawer-handle {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 100px;
    background: rgba(2, 6, 23, 0.98);
    border: 1px solid var(--border-subtle);
    border-right: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-snappy);
    z-index: 901;
}


.drawer-handle:hover {
    color: var(--text-primary);
    background: var(--surface-raised);
}

.drawer-header {
    height: 60px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.drawer-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.drawer-header .header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.drawer-header h3 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.drawer-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-toggle-drawer {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: var(--transition-snappy);
    padding: 0;
}

.btn-toggle-drawer:hover {
    color: var(--text-primary);
}

/* Drawer Chevron Icon */
.logs-drawer .chevron-icon {
    transform: rotate(-90deg); /* point left by default */
    transition: transform var(--transition-snappy);
}

.logs-drawer.expanded .chevron-icon {
    transform: rotate(90deg); /* point right when expanded */
}

.drawer-body {
    flex: 1;
    padding: 24px;
    background: #020306;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer-body .log-window {
    flex: 1;
    height: 100%;
    border: none;
    padding: 0;
    box-shadow: none;
    background: transparent;
    overflow-y: auto;
}

/* Prompt Extras (Prefix / Suffix) */
.prompt-extras-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-field-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-field-inline label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-field-inline input[type="text"] {
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-control);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--sans-text);
    font-size: 13px;
    outline: none;
    transition: var(--transition-snappy);
}

.input-field-inline input[type="text"]:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}


/* Collapsible Settings Header */
.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.config-pane .chevron-icon {
    transform: rotate(0);
    transition: transform var(--transition-snappy);
    color: var(--text-secondary);
}

.config-pane.collapsed .chevron-icon {
    transform: rotate(-90deg);
}

.config-pane.collapsed .config-grid {
    display: none;
}

.config-pane:not(.collapsed) .config-header {
    margin-bottom: 14px;
}

/* Toast System */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    background: rgba(6, 15, 9, 0.95);
    border: 1px solid var(--emerald-700);
    border-radius: var(--radius-badge);
    padding: 12px 18px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    backdrop-filter: blur(8px);
    transform: translateY(-20px);
    opacity: 0;
    transition: all 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--emerald-500);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(74, 168, 255, 0.2);
}

.toast.success svg {
    color: var(--emerald-400);
}

/* ============================================================
   Like / Dislike Rating System
   ============================================================ */
.image-rating-bar {
    display: flex;
    gap: 4px;
    position: absolute;
    top: 6px;
    right: 6px;
    opacity: 0;
    transition: opacity 180ms ease;
    z-index: 5;
}

.group-image-item:hover .image-rating-bar {
    opacity: 1;
}

/* Always show rating indicator when already rated */
.group-image-item.rated-like .image-rating-bar,
.group-image-item.rated-dislike .image-rating-bar {
    opacity: 1;
}

.btn-rate {
    background: rgba(6, 15, 9, 0.75);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    backdrop-filter: blur(4px);
    transition: var(--transition-snappy);
    padding: 0;
}

.btn-rate:hover {
    transform: scale(1.15);
    border-color: rgba(255,255,255,0.25);
}

.btn-rate.btn-like:hover,
.btn-rate.btn-like.active {
    background: rgba(120, 199, 255, 0.25);
    border-color: var(--like-color);
    color: var(--like-color);
    box-shadow: 0 0 10px rgba(120, 199, 255, 0.35);
}

.btn-rate.btn-dislike:hover,
.btn-rate.btn-dislike.active {
    background: rgba(244, 63, 94, 0.2);
    border-color: var(--dislike-color);
    color: var(--dislike-color);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.3);
}

/* Faded/hidden state for disliked images */
.group-image-item.rated-dislike {
    opacity: 0.25;
    filter: saturate(0.2);
    transition: opacity 300ms ease, filter 300ms ease;
}

.group-image-item.rated-dislike:hover {
    opacity: 0.85;
    filter: saturate(0.8);
}

/* ============================================================
   Gallery Filter Bar
   ============================================================ */


.filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-badge);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-snappy);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(74, 168, 255, 0.1);
    border-color: rgba(120, 199, 255, 0.4);
    color: var(--emerald-400);
}

.filter-btn.filter-dislike.active {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--dislike-color);
}

/* Row action buttons in queue */
.col-actions {
    width: 76px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    flex-shrink: 0;
}

.row-action-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-snappy);
    padding: 0;
    flex-shrink: 0;
}

.row-action-btn:hover {
    background: rgba(120, 199, 255, 0.08);
    border-color: rgba(120, 199, 255, 0.3);
    color: var(--emerald-400);
}

.row-action-btn.danger:hover {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.25);
    color: var(--danger);
}

.model-loading-area {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--emerald-400);
    margin-top: 8px;
    font-weight: 500;
    padding: 6px 12px;
    background: rgba(74, 168, 255, 0.05);
    border: 1px solid rgba(74, 168, 255, 0.15);
    border-radius: var(--radius-control);
    animation: pulseGlow 2s infinite ease-in-out;
}

.model-loading-area .spinner {
    display: inline-block;
    animation: spin 2s linear infinite;
    font-size: 13px;
}

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

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(74, 168, 255, 0.1); border-color: rgba(74, 168, 255, 0.15); }
    50% { box-shadow: 0 0 12px rgba(74, 168, 255, 0.25); border-color: rgba(74, 168, 255, 0.35); }
}

.row-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.row-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--emerald-500) 0%, var(--emerald-400) 100%);
    box-shadow: 0 0 8px var(--emerald-400);
    width: 0%;
    transition: none;
}

/* 2026 interface refinement: clearer hierarchy, calmer surfaces, stronger states */
:root {
    --bg: #0c1326;
    --surface-base: #111a31;
    --surface-raised: #182541;
    --text-primary: #f7f9ff;
    --text-secondary: #aebbd6;
    --border-subtle: #2a3a5c;
    --border-hover: #42669b;
    --radius-bento: 16px;
    --radius-inner: 12px;
    --radius-control: 10px;
    --shadow-default: 0 14px 34px -24px rgba(0, 0, 0, 0.88);
    --shadow-glow: 0 18px 44px -26px rgba(74, 168, 255, 0.55);
}

html {
    scroll-behavior: smooth;
}

body {
    padding: 24px clamp(16px, 3vw, 40px) 64px;
    background:
        radial-gradient(900px 520px at 45% -170px, rgba(74, 168, 255, 0.24), transparent 68%),
        radial-gradient(620px 360px at 92% 12%, rgba(85, 217, 248, 0.09), transparent 72%),
        linear-gradient(180deg, #111a31 0%, #0c1326 55%, #09101f 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
select,
input {
    -webkit-tap-highlight-color: transparent;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
    padding: 10px 14px;
    color: #07111f;
    background: var(--emerald-400);
    border-radius: 8px;
    font-weight: 700;
    transform: translateY(-160%);
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-link:focus {
    transform: translateY(0);
}

.app-container {
    max-width: 1360px;
    gap: 20px;
}

.spotlight-banner {
    display: none;
}

.nav-bar {
    top: 12px;
    min-height: 68px;
    padding: 12px 16px;
    background: rgba(14, 23, 43, 0.92);
    box-shadow: 0 16px 40px -28px rgba(0, 0, 0, 0.9);
}

.logo-icon {
    width: 28px;
    height: 28px;
    filter: none;
}

.logo-text h1 {
    font-size: 17px;
    letter-spacing: -0.025em;
}

.status-panel {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.workspace-layout {
    grid-template-columns: minmax(430px, 1.08fr) minmax(420px, 0.92fr);
    gap: 20px;
    align-items: start;
}

.right-column {
    gap: 20px;
}

.bento-card {
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-default);
}

.bento-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-default);
}

.card-header {
    min-height: 64px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.012);
}

.card-body {
    padding: 20px;
}

.header-title h2 {
    font-size: 16px;
    letter-spacing: -0.02em;
}

label {
    color: #d8e3f8;
    font-weight: 600;
}

textarea,
input[type="text"],
input[type="number"],
select {
    min-height: 44px;
    color: var(--text-primary);
    background: #0d162b;
    border-color: #30466f;
}

textarea {
    min-height: 168px;
    padding: 14px 16px;
    line-height: 1.65;
    resize: vertical;
}

textarea::placeholder,
input::placeholder {
    color: #7f91b5;
    opacity: 1;
}

textarea:hover,
input:hover,
select:hover {
    border-color: #4d75ad;
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid rgba(120, 199, 255, 0.48);
    outline-offset: 2px;
}

.btn,
.lang-toggle-btn,
.github-repo-btn,
.restart-server-btn,
.stop-server-btn {
    min-height: 42px;
}

.primary-btn {
    background: var(--emerald-500);
    color: #06101f;
    font-weight: 750;
    box-shadow: 0 10px 26px -12px rgba(74, 168, 255, 0.88);
}

.primary-btn:hover {
    background: var(--emerald-400);
    box-shadow: 0 12px 30px -12px rgba(120, 199, 255, 0.78);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
}

.field-desc {
    color: var(--text-secondary);
    line-height: 1.5;
}

.config-pane,
.prompt-history-section {
    background: rgba(0, 0, 0, 0.08);
    border-color: var(--border-subtle);
}

.queue-table-container {
    scrollbar-gutter: stable;
}

.queue-table th {
    color: #bac9e6;
    background: rgba(255, 255, 255, 0.018);
}

.queue-table td {
    border-color: var(--border-subtle);
}

.gallery-group-card {
    box-shadow: var(--shadow-default);
}

.group-image-item img {
    background: #091126;
}

@media (max-width: 1100px) {
    .workspace-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body {
        padding: 12px 12px 40px;
    }

    .app-container {
        gap: 12px;
    }

    .nav-bar {
        position: relative;
        top: 0;
        align-items: flex-start;
        gap: 12px;
    }

    .logo-text {
        align-items: flex-start;
        flex-direction: column;
        gap: 0;
    }

    .status-panel {
        width: 100%;
        justify-content: flex-start;
    }

    .status-indicator {
        order: -1;
        flex-basis: 100%;
        width: max-content;
    }

    .workspace-layout,
    .right-column {
        gap: 12px;
    }

    .card-header,
    .card-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .prompt-extras-grid,
    .config-grid,
    .action-buttons {
        grid-template-columns: 1fr;
    }

    .input-field[style*="grid-column"] {
        grid-column: auto !important;
    }

    .btn,
    .lang-toggle-btn,
    .github-repo-btn,
    .restart-server-btn,
    .stop-server-btn {
        min-height: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.ui-icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.total-timer,
.q-badge,
.filter-btn,
.image-seed-badge {
    align-items: center;
    gap: 6px;
}

.q-badge .ui-icon,
.image-seed-badge .ui-icon {
    width: 13px;
    height: 13px;
}

.btn-rate .ui-icon {
    width: 15px;
    height: 15px;
}

.empty-icon .ui-icon {
    width: 30px;
    height: 30px;
}

.icon-spin {
    animation: icon-spin 900ms linear infinite;
}

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

/* Semantic color separation */
.status-busy::before {
    background: var(--info);
    box-shadow: 0 0 6px color-mix(in srgb, var(--info) 75%, transparent);
}

.badge-generating,
.badge-active {
    color: #9cecff;
    background: rgba(85, 217, 248, 0.14);
}

.badge-completed {
    color: #a8ed8b;
    background: rgba(126, 217, 87, 0.14);
}

.toast.success {
    border-color: var(--success);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(126, 217, 87, 0.16);
}

.toast.success svg,
.log-entry.server {
    color: var(--success);
}

.btn-like.active {
    background: rgba(102, 184, 255, 0.2);
    border-color: var(--like-color);
    color: #a9d8ff;
    box-shadow: 0 0 10px rgba(102, 184, 255, 0.26);
}

/* Layout system: 4px base rhythm, task-first desktop composition */
:root {
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
}

.app-container {
    gap: var(--space-8);
}

.workspace-layout {
    grid-template-columns: minmax(0, 7fr) minmax(400px, 5fr);
    gap: var(--space-6);
    align-items: stretch;
}

.right-column {
    min-width: 0;
}

.input-panel,
.queue-panel {
    min-height: clamp(640px, calc(100vh - 140px), 780px);
}

.input-panel .card-body {
    flex: 1;
}

.input-panel .action-buttons {
    margin-top: auto;
    padding-top: var(--space-1);
}

.queue-panel .queue-container {
    min-height: 0;
}

.queue-list {
    min-height: 0;
}

.card-header {
    gap: var(--space-4);
}

.card-body {
    gap: var(--space-6);
}

.input-group,
.input-field,
.input-field-inline {
    gap: var(--space-2);
}

.prompt-extras-grid,
.config-grid {
    gap: var(--space-4);
}

.prompt-history-section {
    margin-top: 0;
}

.config-pane {
    padding: var(--space-5);
}

.config-header {
    min-height: 24px;
}

.action-buttons {
    gap: var(--space-3);
}

.gallery-section {
    margin-top: 0;
}

.gallery-section > .card-header {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
}

.gallery-actions {
    min-width: 0;
    justify-content: flex-end;
}

.gallery-filter-bar {
    min-width: 0;
}

.gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: var(--space-5);
}

@media (min-width: 1500px) {
    .app-container {
        max-width: 1440px;
    }

    .workspace-layout {
        grid-template-columns: minmax(0, 3fr) minmax(440px, 2fr);
        gap: var(--space-8);
    }
}

@media (max-width: 1180px) {
    .workspace-layout {
        grid-template-columns: minmax(0, 1fr) minmax(380px, 0.9fr);
    }

    .gallery-section > .card-header {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .gallery-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 960px) {
    .app-container {
        gap: var(--space-5);
    }

    .workspace-layout {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .input-panel,
    .queue-panel {
        min-height: auto;
    }

    .queue-panel {
        min-height: 540px;
    }

    .input-panel .action-buttons {
        margin-top: 0;
    }
}

@media (max-width: 720px) {
    .app-container,
    .workspace-layout,
    .right-column {
        gap: var(--space-4);
    }

    .card-header {
        min-height: 56px;
        gap: var(--space-3);
    }

    .card-body {
        gap: var(--space-5);
    }

    .header-left-group {
        min-width: 0;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .queue-controls {
        margin-left: auto;
    }

    .gallery-actions,
    .gallery-filter-bar {
        width: 100%;
    }

    .gallery-filter-bar {
        overflow-x: auto;
        padding-bottom: var(--space-1);
        scrollbar-width: thin;
    }

    .gallery-actions > .btn {
        flex: 1 1 calc(50% - var(--space-2));
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-3);
    }
}

@media (max-width: 420px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-actions > .btn {
        flex-basis: 100%;
    }
}
