/* ============================================================
 * app.css — Fotooptimering kunde-portal + admin
 * Konsolideret fra PROD's index.php inline <style>-blokke
 * (job-detail + landing) med duplikater fjernet.
 * ============================================================ */

/* ----- Layout-skelet ---------------------------------------- */

body.app-layout { background-color: #f3f4f6 !important; }

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* .app-topbar base font — layout rules live in MOBILE APP SHELL section below */
.app-topbar {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.app-flash {
    margin: 12px auto; max-width: 1200px;
    padding: 10px 16px; border-radius: 8px;
    font-family: 'Inter', sans-serif; font-size: 14px;
}
.app-flash.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.app-flash.ok    { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.app-flash.info  { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }


/* ----- Container + header ----------------------------------- */

.pp-container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

.pp-breadcrumb {
    font-family: 'Inter', sans-serif; font-size: 13px;
    color: #6b7280; margin-bottom: 8px;
}
.pp-breadcrumb a { color: #6b7280; text-decoration: none; }
.pp-breadcrumb a:hover { color: #3b82f6; }

.pp-header { margin-bottom: 24px; }
.pp-header h1 {
    font-family: 'Inter', sans-serif; font-size: 26px; font-weight: 700;
    color: #111827; margin: 0 0 4px 0;
}
.pp-header p {
    font-family: 'Inter', sans-serif; font-size: 14px;
    color: #6b7280; margin: 0;
}


/* ----- Card --------------------------------------------------- */

.pp-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 24px; margin-bottom: 20px;
}
.pp-card h2 {
    font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 600;
    color: #111827; margin: 0 0 14px 0;
}
.pp-card p {
    font-family: 'Inter', sans-serif; font-size: 14px;
    color: #4b5563; margin: 0 0 12px 0; line-height: 1.55;
}
.pp-card-head-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.pp-card-head-row h2 { margin: 0; }


/* ----- Form-elementer --------------------------------------- */

.pp-label {
    display: block;
    font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500;
    color: #374151; margin-bottom: 6px;
}
.pp-input {
    width: 100%; padding: 9px 12px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-family: 'Inter', sans-serif; font-size: 14px; color: #111827;
    outline: none; box-sizing: border-box;
}
.pp-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.pp-help {
    font-family: 'Inter', sans-serif; font-size: 12px;
    color: #6b7280; margin-top: 6px;
}


/* ----- Drop-zone -------------------------------------------- */

.pp-dropzone {
    border: 2px dashed #d1d5db; border-radius: 12px; padding: 36px 20px;
    background: #f9fafb; text-align: center;
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
}
.pp-dropzone:hover, .pp-dropzone.dragover {
    border-color: #4f46e5; background: #eef2ff;
}
.pp-dropzone-icon { font-size: 36px; color: #9ca3af; margin-bottom: 8px; }
.pp-dropzone h3 {
    font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 600;
    color: #111827; margin: 0 0 4px 0;
}
.pp-dropzone p {
    font-family: 'Inter', sans-serif; font-size: 13px;
    color: #6b7280; margin: 0;
}
.pp-dropzone.disabled { opacity: 0.5; pointer-events: none; }


/* ----- Upload-grid + thumbnails ------------------------------ */

.pp-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 16px; margin-top: 20px;
}
@media (max-width: 900px) { .pp-grid { grid-template-columns: repeat(2, 1fr); } }

.pp-thumb {
    position: relative; border-radius: 10px; overflow: hidden;
    border: 2px solid #e5e7eb; background: #f3f4f6;
    aspect-ratio: 3 / 4;
}
.pp-thumb.primary {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.pp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pp-thumb-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 50%);
    opacity: 0; transition: opacity 0.15s;
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 8px 10px;
    pointer-events: none;
}
.pp-thumb:hover .pp-thumb-overlay { opacity: 1; }

.pp-thumb-btn {
    background: rgba(255,255,255,0.95); border: none;
    padding: 4px 8px; border-radius: 5px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 500;
    color: #111827; cursor: pointer;
    pointer-events: auto;
}
.pp-thumb-btn:hover { background: #fff; }
.pp-thumb-btn.danger { color: #dc2626; }

.pp-thumb-badge {
    position: absolute; top: 8px; left: 8px;
    background: #4f46e5; color: #fff;
    padding: 3px 8px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}

.pp-thumb-role {
    position: absolute; bottom: 8px; left: 8px; right: 8px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #e5e7eb; border-radius: 6px;
    padding: 5px 8px;
    font-family: 'Inter', sans-serif; font-size: 11px;
    color: #111827; outline: none; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    z-index: 3;
}
.pp-thumb-role select {
    border: none; background: transparent; outline: none;
    font-family: inherit; font-size: 11px; color: inherit;
    flex: 1; cursor: pointer;
}
.pp-role-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pp-role-dot.identity_reference   { background: #4f46e5; }
.pp-role-dot.style_reference      { background: #10b981; }
.pp-role-dot.background_reference { background: #f59e0b; }
.pp-role-dot.failed_comparison    { background: #ef4444; }

.pp-thumb-uploading {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif; font-size: 12px; color: #4b5563;
}


/* ----- Style-cards ------------------------------------------ */

.pp-style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .pp-style-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .pp-style-grid { grid-template-columns: 1fr; } }

.pp-style-card {
    position: relative;
    border: 2px solid #e5e7eb; background: #fff;
    border-radius: 10px; padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    display: flex; flex-direction: column; gap: 8px;
}
.pp-style-card:hover { border-color: #c7d2fe; background: #fafbff; }
.pp-style-card.selected {
    border-color: #4f46e5; background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.pp-style-icon {
    width: 36px; height: 36px; border-radius: 8px;
    background: #eef2ff; color: #4338ca;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.pp-style-card.selected .pp-style-icon { background: #4f46e5; color: #fff; }
.pp-style-name {
    font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
    color: #111827;
}
.pp-style-desc {
    font-family: 'Inter', sans-serif; font-size: 12px; color: #6b7280;
    line-height: 1.4;
}
.pp-style-check {
    position: absolute; top: 12px; right: 12px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #4f46e5; color: #fff;
    display: none; align-items: center; justify-content: center;
    font-size: 11px;
}
.pp-style-card.selected .pp-style-check { display: flex; }
.pp-style-custom-badge {
    display: inline-block; padding: 1px 8px;
    background: #fef3c7; color: #92400e;
    border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-left: 6px;
}


/* ----- Preview-grid ----------------------------------------- */

.pp-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .pp-preview-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .pp-preview-grid { grid-template-columns: 1fr; } }

.pp-preview {
    position: relative; border-radius: 10px; overflow: hidden;
    border: 2px solid #e5e7eb; background: #f3f4f6;
    aspect-ratio: 2 / 3;
}
.pp-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-preview.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.pp-preview-num {
    position: absolute; top: 8px; left: 8px;
    background: rgba(17,24,39,0.85); color: #fff;
    padding: 3px 9px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600;
    z-index: 2;
}
.pp-preview-actions { position: absolute; top: 8px; right: 8px; z-index: 2; }
.pp-preview-actions select {
    background: rgba(255,255,255,0.95);
    border: 1px solid #e5e7eb; border-radius: 6px;
    padding: 4px 8px;
    font-family: 'Inter', sans-serif; font-size: 11px;
    color: #111827; cursor: pointer; outline: none;
}
.pp-preview-actions select:hover {
    background: #fff; border-color: #4f46e5;
}


/* ----- Pre-generate summary --------------------------------- */

.pp-send-list { display: flex; flex-direction: column; gap: 10px; }
.pp-send-row {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb; border-radius: 10px;
    background: #fff;
}
.pp-send-thumb {
    width: 56px; height: 75px; border-radius: 6px; overflow: hidden;
    background: #f3f4f6; flex-shrink: 0; border: 1px solid #e5e7eb;
}
.pp-send-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-send-meta {
    flex: 1; display: flex; flex-direction: column; gap: 4px;
    font-family: 'Inter', sans-serif;
}
.pp-send-role {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600; color: #111827;
}
.pp-send-pos {
    color: #9ca3af; font-weight: 500;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 11px;
}
.pp-send-filename { font-size: 12px; color: #6b7280; }
.pp-send-empty {
    padding: 14px 16px; border-radius: 10px;
    background: #fffbeb; border: 1px solid #fde68a;
    font-family: 'Inter', sans-serif; font-size: 13px;
    color: #92400e; line-height: 1.5;
}
.pp-send-empty strong { color: #78350f; }


/* ----- Status / pills --------------------------------------- */

.pp-status {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: 8px;
    font-family: 'Inter', sans-serif; font-size: 13px;
    margin-top: 12px;
}
.pp-status-info { background: #eef2ff; color: #4338ca; }
.pp-status-warn { background: #fffbeb; color: #92400e; }
.pp-status-ok   { background: #f0fdf4; color: #166534; }

.pp-pill {
    padding: 2px 8px; border-radius: 999px; font-size: 11px;
    font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
}
.pp-pill-draft    { background: #f3f4f6; color: #6b7280; }
.pp-pill-uploaded { background: #dbeafe; color: #1e40af; }
.pp-pill-generating  { background: #fef3c7; color: #92400e; }
.pp-pill-preview_ready { background: #dcfce7; color: #166534; }
.pp-pill-failed   { background: #fee2e2; color: #991b1b; }
.pp-pill-other    { background: #fef3c7; color: #92400e; }


/* ----- Buttons ---------------------------------------------- */

.pp-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 20px;
}

.pp-btn {
    padding: 9px 18px; background: #4f46e5; color: #fff; border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none; display: inline-block;
}
.pp-btn:hover { background: #4f46e5; color: #fff; }
.pp-btn:disabled { background: #d1d5db; cursor: not-allowed; }
.pp-btn.secondary {
    background: #fff; color: #374151; border: 1px solid #d1d5db;
}
.pp-btn.secondary:hover { background: #f9fafb; color: #111827; }
.pp-btn.danger {
    background: #fff; color: #dc2626; border: 1px solid #fecaca;
}
.pp-btn.danger:hover {
    background: #fef2f2; color: #b91c1c; border-color: #fca5a5;
}

.pp-link-danger {
    font-family: 'Inter', sans-serif; font-size: 12px; color: #dc2626;
    background: none; border: none; cursor: pointer; padding: 4px 10px;
    border-radius: 6px; transition: background 0.15s;
}
.pp-link-danger:hover { background: #fef2f2; color: #b91c1c; }

.pp-cta {
    display: inline-block; padding: 11px 22px;
    background: #4f46e5; color: #fff;
    border-radius: 8px;
    font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
    text-decoration: none; margin-top: 8px;
}
.pp-cta:hover { background: #4f46e5; color: #fff; text-decoration: none; }


/* ----- Loading-overlay -------------------------------------- */

.pp-loading-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(17,24,39,0.65);
    z-index: 9999; align-items: center; justify-content: center;
}
.pp-loading-overlay.active { display: flex; }
.pp-loading-card {
    background: #fff; border-radius: 14px; padding: 28px 36px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    max-width: 380px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.pp-spinner {
    width: 44px; height: 44px;
    border: 4px solid #e5e7eb; border-top-color: #4f46e5;
    border-radius: 50%;
    animation: pp-spin 0.9s linear infinite;
}
@keyframes pp-spin { to { transform: rotate(360deg); } }
.pp-loading-card h3 {
    font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 600;
    color: #111827; margin: 0;
}
.pp-loading-card p {
    font-family: 'Inter', sans-serif; font-size: 13px;
    color: #6b7280; margin: 0; line-height: 1.5;
}


/* ----- Landing / dashboard --------------------------------- */

.pp-badge {
    display: inline-block; padding: 3px 10px;
    background: #eef2ff; color: #4338ca;
    border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 500;
    margin-bottom: 12px;
}

.pp-steps { list-style: none; margin: 16px 0 0 0; padding: 0; }
.pp-steps li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-family: 'Inter', sans-serif; font-size: 13px; color: #374151;
}
.pp-steps li:last-child { border-bottom: none; }
.pp-steps li .pp-step-num {
    flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
    background: #4f46e5; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
}

.pp-jobs { margin-top: 18px; }
.pp-job-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-family: 'Inter', sans-serif; font-size: 13px;
}
.pp-job-row:last-child { border-bottom: none; }
.pp-job-row a {
    color: #4338ca; text-decoration: none; font-weight: 500;
}
.pp-job-row .pp-job-meta { color: #6b7280; }


/* ----- Auth-sider (login/register/verify) ------------------- */

.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.auth-card h1 {
    font-family: 'Inter', sans-serif; font-size: 22px; font-weight: 700;
    color: #111827; margin: 0 0 6px 0;
}
.auth-card .lede {
    font-family: 'Inter', sans-serif; font-size: 14px;
    color: #6b7280; margin: 0 0 22px 0; line-height: 1.5;
}
.auth-card .field { margin-bottom: 14px; }
.auth-card .alt-action {
    font-family: 'Inter', sans-serif; font-size: 13px;
    color: #6b7280; margin: 18px 0 0 0; text-align: center;
}
.auth-card .alt-action a { color: #4338ca; text-decoration: none; }


/* ============================================================
 * Quality Engine — 9-grid review
 * ============================================================ */

.qe-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 14px;
}
@media (max-width: 1100px) {
    .qe-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
    .qe-grid { grid-template-columns: 1fr; }
}

.qe-cell {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.qe-cell-identity {
    background: #0f172a;
    border-color: #1e293b;
    position: relative;
}
.qe-cell-identity img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}
.qe-cell-label {
    position: absolute; top: 10px; left: 10px;
    background: #f59e0b; color: #0f172a;
    padding: 3px 10px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em;
}
.qe-empty, .qe-cell-empty {
    padding: 50px 20px;
    text-align: center;
    color: #cbd5e1;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: #f8fafc;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qe-preview-card {
    display: flex;
    flex-direction: column;
}
.qe-preview-img-wrap {
    position: relative;
    background: #f3f4f6;
    aspect-ratio: 3/4;
    overflow: hidden;
}
.qe-preview-img-wrap img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.qe-preview-num {
    position: absolute; top: 8px; left: 8px;
    background: rgba(17,24,39,0.85); color: #fff;
    padding: 3px 9px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600;
    z-index: 2;
}
.qe-preview-rank-badge {
    position: absolute; top: 8px; right: 8px;
    padding: 4px 10px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em;
    z-index: 2;
}
.qe-rank-best        { background: #16a34a; color: #fff; }
.qe-rank-second_best { background: #f59e0b; color: #0f172a; }
.qe-rank-worst       { background: #dc2626; color: #fff; }

.qe-score-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}
.qe-score-slider {
    flex: 1;
    accent-color: #4338ca;
}
.qe-score-display {
    width: 28px; text-align: center;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 16px; font-weight: 700; color: #0f172a;
}
.qe-score-display.qe-score-unset { color: #cbd5e1; }

.qe-rank-row {
    display: flex; gap: 6px; padding: 8px 12px;
    border-top: 1px solid #f1f5f9;
}
.qe-rank-btn {
    flex: 1;
    padding: 6px 0;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 6px;
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.1s;
}
.qe-rank-btn:hover { background: #f8fafc; color: #0f172a; }
.qe-rank-btn.active.best   { background: #16a34a; color: #fff; border-color: #16a34a; }
.qe-rank-btn.active.second { background: #f59e0b; color: #0f172a; border-color: #f59e0b; }
.qe-rank-btn.active.worst  { background: #dc2626; color: #fff; border-color: #dc2626; }

.qe-tag-section {
    border-top: 1px solid #f1f5f9;
}
.qe-tag-section summary {
    padding: 8px 12px;
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 500;
    color: #475569;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.qe-tag-section summary::-webkit-details-marker { display: none; }
.qe-tag-section summary::before { content: '▸ '; color: #94a3b8; }
.qe-tag-section[open] summary::before { content: '▾ '; }
.qe-tag-section summary:hover { background: #f8fafc; }

.qe-chips {
    padding: 4px 12px 10px 12px;
    display: flex; flex-wrap: wrap; gap: 4px;
}
.qe-chip {
    padding: 3px 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.1s;
    line-height: 1.3;
}
.qe-chip:hover { background: #f8fafc; }
.qe-chip-positive.on { background: #dcfce7; color: #166534; border-color: #86efac; }
.qe-chip-negative.on { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

.qe-useas {
    padding: 4px 12px 10px 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.qe-useas-item {
    display: flex; align-items: center; gap: 6px;
    font-family: 'Inter', sans-serif; font-size: 11px;
    color: #475569;
    cursor: pointer;
    padding: 2px 0;
}
.qe-useas-item input[type="checkbox"] {
    width: 14px; height: 14px;
    accent-color: #4338ca;
}

.qe-save-status {
    padding: 6px 12px;
    border-top: 1px solid #f1f5f9;
    font-family: 'Inter', sans-serif; font-size: 11px;
    color: #94a3b8;
    text-align: right;
    min-height: 22px;
}
.qe-save-status[data-status="saving"] { color: #4338ca; }
.qe-save-status[data-status="saved"]  { color: #16a34a; }
.qe-save-status[data-status="error"]  { color: #dc2626; }

.qe-extra-note {
    grid-column: 1 / -1;
    padding: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-family: 'Inter', sans-serif; font-size: 12px;
    color: #92400e;
    text-align: center;
}


/* ----- Library (top/bottom previews) ------------------------ */

.qe-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.qe-library-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.15s, box-shadow 0.15s;
}
.qe-library-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.qe-library-item img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}
.qe-library-meta {
    padding: 8px 10px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.qe-library-score {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 13px; font-weight: 700;
}
.qe-score-good { background: #dcfce7; color: #166534; }
.qe-score-bad  { background: #fee2e2; color: #991b1b; }


/* ============================================================
 * Admin Training (1-vs-1 prompt iteration)
 * ============================================================ */

.qt-matrix {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0 auto 14px;
    /* 75% af container-bredde så billederne fylder mindre vertical space —
       lader sliders + score være synlig i samme viewport. */
    max-width: 75%;
}
@media (max-width: 800px) {
    .qt-matrix { grid-template-columns: 1fr; max-width: 100%; }
}
.qt-pane {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    aspect-ratio: 3/4;
}
.qt-pane img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.qt-pane-label {
    position: absolute; top: 10px; left: 10px;
    background: rgba(15,23,42,0.85); color: #fff;
    padding: 4px 12px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em;
    z-index: 2;
}
.qt-pane-empty {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 30px;
    color: #94a3b8; font-family: 'Inter', sans-serif; font-size: 13px;
    text-align: center;
}

.qt-rating-row {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 0;
    flex-wrap: wrap;
}
.qt-rating-score {
    flex: 1; min-width: 280px;
    display: flex; align-items: center; gap: 12px;
}
.qt-rating-actions {
    display: flex; gap: 8px;
}

.qt-chips {
    display: flex; flex-wrap: wrap; gap: 4px;
}
.qt-chip {
    padding: 4px 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px;
    color: #475569;
    cursor: pointer;
}
.qt-chip:hover { background: #f8fafc; }
.qt-chip-positive.on { background: #dcfce7; color: #166534; border-color: #86efac; }
.qt-chip-negative.on { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

.qt-history {
    display: flex; flex-direction: column; gap: 8px;
}
.qt-history-item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}
.qt-history-item.latest { border-color: #4338ca; background: #eef2ff; }
.qt-history-item img {
    width: 80px; height: 100px; object-fit: cover; border-radius: 6px; flex-shrink: 0;
}
.qt-history-meta {
    flex: 1; font-family: 'Inter', sans-serif; font-size: 12px; color: #475569;
    min-width: 0;
}

/* ----- Reference-thumbnails ----- */
.qt-ref-thumb {
    position: relative;
    width: 100px; height: 130px;
    border-radius: 8px; overflow: hidden;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}
.qt-ref-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.qt-ref-thumb-label {
    position: absolute; bottom: 4px; left: 4px;
    color: #fff; padding: 2px 6px; border-radius: 4px;
    font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.qt-ref-thumb-delete {
    position: absolute; top: 4px; right: 4px;
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(0,0,0,0.7); color: #fff; border: none;
    font-size: 14px; font-weight: 700; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.qt-ref-thumb-delete:hover { background: #dc2626; }


/* ============================================================
 * Batch Review (3-column layout)
 * ============================================================ */

.qb-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 14px;
    align-items: start;
}
@media (max-width: 1100px) {
    .qb-layout { grid-template-columns: 200px 1fr; }
}

.qb-sidebar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    position: sticky;
    top: 14px;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.qb-items-scroll {
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}
.qb-item {
    display: flex;
    gap: 8px;
    padding: 8px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}
.qb-item:hover { background: #f8fafc; }
.qb-item-selected { background: #eef2ff; outline: 2px solid #4338ca; }
.qb-item-thumb {
    width: 48px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #f3f4f6;
}
.qb-item-meta {
    flex: 1;
    min-width: 0;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
}
.qb-item-name {
    color: #0f172a;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qb-item-status {
    margin-top: 2px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.qb-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.qb-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 900px) {
    .qb-pair { grid-template-columns: 1fr; }
}
.qb-pane {
    position: relative;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 3/4;
}
.qb-pane img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.qb-pane-label {
    position: absolute; top: 10px; left: 10px;
    background: rgba(15,23,42,0.85); color: #fff;
    padding: 4px 12px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em;
    z-index: 2;
}
.qb-pane-empty {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 30px;
    color: #94a3b8; font-family: 'Inter', sans-serif; font-size: 13px;
    text-align: center;
}

.qb-history {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
}
.qb-history-label {
    font-family: 'Inter', sans-serif; font-size: 12px;
    color: #475569; font-weight: 500; margin-bottom: 6px;
}
.qb-history-strip {
    display: flex; gap: 8px; overflow-x: auto;
    padding-bottom: 4px;
}
.qb-history-thumb {
    position: relative;
    flex-shrink: 0;
    width: 70px;
    height: 90px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: #f3f4f6;
}
.qb-history-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qb-history-thumb.current   { border-color: #4338ca; box-shadow: 0 0 0 2px rgba(67,56,202,0.2); }
.qb-history-thumb.approved  { border-color: #16a34a; box-shadow: 0 0 0 2px rgba(22,163,74,0.2); }
.qb-history-num {
    position: absolute; top: 2px; left: 2px;
    background: rgba(15,23,42,0.85); color: #fff;
    font-size: 9px; padding: 1px 5px; border-radius: 3px;
    font-family: ui-monospace, monospace;
}
.qb-history-badge {
    position: absolute; top: 2px; right: 2px;
    background: #16a34a; color: #fff;
    font-size: 11px; font-weight: 700;
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.qb-rating-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.qb-chips {
    display: flex; flex-wrap: wrap; gap: 4px;
}
.qb-chip {
    padding: 4px 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px;
    color: #475569;
    cursor: pointer;
}
.qb-chip:hover { background: #f8fafc; }
.qb-chip-positive.on { background: #dcfce7; color: #166534; border-color: #86efac; }
.qb-chip-negative.on { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }


/* ============================================================
 * Batch review — Sidebar overlays + source badges
 * ============================================================ */

.qb-item-thumb-wrap {
    position: relative;
    width: 48px; height: 60px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #f3f4f6;
}
.qb-item-thumb-wrap .qb-item-thumb {
    width: 48px; height: 60px;
    object-fit: cover; display: block;
}
.qb-thumb-dim {
    filter: grayscale(0.6) brightness(0.7);
    opacity: 0.85;
}
.qb-item-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 1px 2px;
    font-family: 'Inter', sans-serif;
    font-size: 8px; font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    line-height: 1.3;
}
.qb-ov-queued     { background: rgba(75,85,99,0.92); }
.qb-ov-generating { background: rgba(245,158,11,0.92); color: #0f172a; }
.qb-ov-rerun      {
    background: rgba(234,88,12,0.95);  /* tydelig orange — adskiller "kører igen" fra første-gangs generation */
    color: #fff;
    animation: qb-rerun-pulse 1.6s ease-in-out infinite;
}
.qb-ov-ready      { background: rgba(67,56,202,0.92); }
.qb-ov-approved   { background: rgba(22,163,74,0.92); }
.qb-ov-rejected   { background: rgba(220,38,38,0.92); }
.qb-ov-failed     { background: rgba(220,38,38,0.92); }

@keyframes qb-rerun-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.65; }
}

.qb-item-source-badge {
    position: absolute;
    top: 2px; left: 2px;
    background: rgba(15,23,42,0.85);
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 8px; font-weight: 700;
    letter-spacing: 0.04em;
}
.qb-item-version-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: rgba(234,88,12,0.95);
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 9px; font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.qb-item-score {
    margin-top: 2px;
    font-size: 10px;
    color: #475569;
    font-family: ui-monospace, monospace;
    font-weight: 600;
}
.qb-item { align-items: stretch; }


/* ============================================================
 * Batch review — Main pane labels + placeholder
 * ============================================================ */

.qb-pane-label-grp {
    position: absolute; top: 10px; left: 10px;
    z-index: 2;
    display: flex; flex-direction: column; gap: 3px;
}
.qb-pane-label-grp .qb-pane-label {
    position: static;
    background: rgba(15,23,42,0.85); color: #fff;
    padding: 4px 12px; border-radius: 999px;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em;
    align-self: flex-start;
}
.qb-pane-label-approved { background: #16a34a !important; }
.qb-pane-source {
    background: rgba(15,23,42,0.65);
    color: #cbd5e1;
    padding: 2px 8px;
    border-radius: 999px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 9px; font-weight: 600;
    letter-spacing: 0.04em;
    align-self: flex-start;
}

.qb-pane-placeholder {
    width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 30px;
    font-family: 'Inter', sans-serif;
    text-align: center;
    gap: 8px;
}
.qb-pane-placeholder-icon { font-size: 42px; opacity: 0.7; }
.qb-pane-placeholder-label { font-size: 14px; font-weight: 700; letter-spacing: 0.05em; }
.qb-pane-placeholder-sub { font-size: 12px; color: #64748b; max-width: 280px; line-height: 1.5; }
.qb-pane-placeholder-qb-ov-queued     { background: #f8fafc; color: #475569; }
.qb-pane-placeholder-qb-ov-generating { background: #fef3c7; color: #92400e; }
.qb-pane-placeholder-qb-ov-ready      { background: #eef2ff; color: #4338ca; }
.qb-pane-placeholder-qb-ov-approved   { background: #dcfce7; color: #166534; }
.qb-pane-placeholder-qb-ov-rejected   { background: #fee2e2; color: #991b1b; }
.qb-pane-placeholder-qb-ov-failed     { background: #fee2e2; color: #991b1b; }


/* ============================================================
 * Batch review — Actions panel (rating + buttons + tags)
 * ============================================================ */

.qb-actions { padding: 14px 18px; }

.qb-rating-block {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 12px;
}
.qb-rating-label {
    font-family: 'Inter', sans-serif;
    font-size: 12px; font-weight: 700;
    color: #475569;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}
.qb-rating-numbers { display: flex; gap: 4px; flex-wrap: wrap; }
.qb-rating-num {
    width: 38px; height: 38px;
    border: 2px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 15px; font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.1s;
}
.qb-rating-num:hover { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
.qb-rating-num.active { transform: scale(1.06); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.qb-rating-good.active { background: #16a34a; color: #fff; border-color: #16a34a; }
.qb-rating-mid.active  { background: #4338ca; color: #fff; border-color: #4338ca; }
.qb-rating-bad.active  { background: #dc2626; color: #fff; border-color: #dc2626; }

.qb-action-row {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    padding: 8px 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 12px;
}
.qb-btn-approve { background: #16a34a; }
.qb-btn-approve:hover { background: #15803d; }

.qb-tags-section { margin-bottom: 12px; }
.qb-tags-section summary {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 12px; font-weight: 600;
    color: #475569;
    padding: 6px 0;
    user-select: none;
}
.qb-tags-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 8px;
}
@media (max-width: 900px) { .qb-tags-grid { grid-template-columns: 1fr; } }
.qb-tags-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 4px;
}
.qb-correction-block { margin-top: 6px; }


/* ============================================================
 * Batch review — Compact versions strip
 * ============================================================ */

.qb-versions-card { padding: 12px 14px; }
.qb-versions-strip {
    display: flex; gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
}
.qb-vstrip {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    width: 110px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: all 0.1s;
}
.qb-vstrip:hover { border-color: #4338ca; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.qb-vstrip.current  { border-color: #4338ca; background: #eef2ff; }
.qb-vstrip.approved { border-color: #16a34a; background: #f0fdf4; }
.qb-vstrip-thumb {
    position: relative;
    width: 110px; height: 140px;
    background: #f3f4f6;
}
.qb-vstrip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qb-vstrip-badge {
    position: absolute; top: 4px; right: 4px;
    background: #16a34a; color: #fff;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800;
}
.qb-vstrip-current {
    position: absolute; top: 4px; right: 4px;
    width: 12px; height: 12px;
    background: #4338ca;
    border-radius: 50%;
    border: 2px solid #fff;
}
.qb-vstrip-meta {
    padding: 6px 8px;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: #475569;
}
.qb-vstrip-row1 {
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 2px;
}
.qb-vstrip-v { font-weight: 700; color: #0f172a; font-size: 11px; }
.qb-vstrip-id { font-family: ui-monospace, Menlo, monospace; font-size: 9px; color: #94a3b8; }
.qb-vstrip-source {
    font-size: 9px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: auto;
}
.qb-vstrip-row2 {
    display: flex; justify-content: space-between;
    color: #64748b; font-size: 10px;
}
.qb-vstrip-row3 {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 9px; color: #94a3b8;
    margin-top: 2px;
}
.qb-vstrip-correction {
    margin-top: 4px;
    padding: 3px 5px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 3px;
    font-size: 9px;
    line-height: 1.3;
    cursor: help;
}


/* ============================================================
 * Batch review — Debug metadata + Prompt-log modal
 * ============================================================ */

.qb-debug summary {
    cursor: pointer;
    font-size: 12px;
    color: #475569;
    font-weight: 500;
    user-select: none;
}
.qb-debug-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
}
.qb-debug-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
    vertical-align: top;
}
.qb-debug-table td:first-child { color: #64748b; width: 220px; font-weight: 500; }
.qb-debug-table td:last-child { color: #0f172a; }
.qb-debug-table code {
    font-size: 11px;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
}

.qb-modal {
    position: fixed; inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qb-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.65); }
.qb-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.qb-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
}
.qb-modal-close {
    background: none; border: none;
    font-size: 24px; color: #64748b;
    cursor: pointer; padding: 0; line-height: 1;
}
.qb-modal-close:hover { color: #0f172a; }
.qb-modal-body { padding: 14px 18px; overflow-y: auto; }


/* ============================================================
 * Batch review — slim top bar (erstatter den store progress-card)
 * ============================================================ */

.qb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #0f172a;
}


/* ============================================================
 * Tone Matrix (fase 1.5) — 3x3 lokal ImageMagick-grid + banner
 * ============================================================ */

/* Prominent strip mellem 2-pane og action-card — kan ikke overses */
.qb-tone-strip {
    margin: 12px 0;
    padding: 14px 18px;
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 8px rgba(15,23,42,0.15);
}
.qb-tone-strip-text {
    flex: 1;
    min-width: 280px;
    font-size: 13px;
}
.qb-tone-strip-text strong {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fde68a;
}
.qb-tone-strip-text span { color: #cbd5e1; margin-left: 6px; }
.qb-tone-strip-btn {
    padding: 10px 18px;
    background: #fde68a;
    color: #0f172a;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.qb-tone-strip-btn:hover { background: #fcd34d; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.qb-tone-strip-btn:active { transform: translateY(0); }
/* B/W matrix-knap: invertet — sort knap med hvid tekst */
.qb-tone-strip-btn-bw {
    background: #f8fafc;
    color: #0f172a;
    border: 2px solid #f8fafc;
}
.qb-tone-strip-btn-bw:hover { background: #fff; }

/* Background matrix-knap: tydeligt anderledes farve (OpenAI-cost = ikke gratis) */
.qb-tone-strip-btn-bg {
    background: #4338ca;
    color: #fff;
    border: 2px solid #4338ca;
}
.qb-tone-strip-btn-bg:hover { background: #3730a3; }

/* Fixed BG-knap: grøn (gratis, lokal — fase 1.7b prototype) */
.qb-tone-strip-btn-fixed {
    background: #16a34a;
    color: #fff;
    border: 2px solid #16a34a;
}
.qb-tone-strip-btn-fixed:hover { background: #15803d; }

/* Pending-celler i bg-matrix mens variants genereres */
.qb-tone-cell-pending {
    border: 1px dashed #cbd5e1;
    background: #fafbfc;
}
.qb-tone-cell-pending:hover {
    border-color: #94a3b8;
    box-shadow: none;
}

.qb-tone-banner {
    margin-top: 12px;
    padding: 10px 14px;
    background: linear-gradient(90deg, #ecfdf5 0%, #f0fdf4 100%);
    border: 1px solid #86efac;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #166534;
}
.qb-tone-banner i { color: #16a34a; }
.qb-tone-banner a { color: #166534; text-decoration: underline; font-weight: 600; }

/* Modal-størrelse — alle 9 celler skal kunne ses uden scroll */
.qb-tone-modal-content {
    max-width: 1500px;
    width: 96vw;
    max-height: 96vh;
    height: 96vh;
    display: flex;
    flex-direction: column;
}
.qb-tone-modal-body {
    flex: 1;
    overflow: hidden;  /* NO scroll */
    display: flex;
    flex-direction: row;
    gap: 14px;
    padding: 12px 14px !important;
}

/* Reference-kolonne: kundens originalfoto til venstre */
.qb-tone-reference {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: 'Inter', sans-serif;
}
.qb-tone-ref-label {
    font-size: 10px;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.qb-tone-ref-thumb {
    flex: 1;
    min-height: 0;
    border: 2px solid #4338ca;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
}
.qb-tone-ref-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 25%;
    display: block;
}
.qb-tone-ref-name {
    font-size: 10px;
    font-weight: 700;
    color: #4338ca;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.qb-tone-ref-filename {
    font-size: 10px;
    color: #94a3b8;
    font-family: ui-monospace, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .qb-tone-modal-body { flex-direction: column; }
    .qb-tone-reference { width: auto; flex-direction: row; align-items: center; }
    .qb-tone-ref-thumb { width: 80px; height: 80px; flex: 0 0 80px; }
}

.qb-tone-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    font-family: 'Inter', sans-serif;
    flex: 1;
    min-height: 0;  /* tillader children at krymp */
}
@media (max-width: 720px) {
    .qb-tone-grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
    #qb-tone-modal .qb-modal-content { height: auto; max-height: 90vh; }
    #qb-tone-modal .qb-modal-body { overflow-y: auto; }
}

.qb-tone-loading {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    padding: 40px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    align-self: center;
}

.qb-tone-cell {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    transition: all 0.12s;
    min-height: 0;
    min-width: 0;
}
.qb-tone-cell:hover { border-color: #4338ca; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.qb-tone-cell-ai {
    border: 2px solid #0f172a;
    background: #f8fafc;
}
.qb-tone-cell-ai:hover { border-color: #0f172a; box-shadow: 0 2px 12px rgba(0,0,0,0.15); }

.qb-tone-thumb {
    width: 100%;
    flex: 1;
    background: #f3f4f6;
    overflow: hidden;
    min-height: 0;
}
.qb-tone-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 30%;  /* vis ansigtet (øverst af portræt) frem for tøj */
    display: block;
}

.qb-tone-meta {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}
.qb-tone-name {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qb-tone-badge { display: none; }  /* skjul badges i kompakt-grid; AI-cellen bruger border + name */
.qb-tone-use {
    margin: 0 0 0 auto;
    font-size: 11px !important;
    padding: 4px 10px !important;
    flex-shrink: 0;
    white-space: nowrap;
}
.qb-tone-cell-ai .qb-tone-name::before { content: '★ '; color: #f59e0b; }

.qb-tone-cell-missing {
    border-color: #fecaca;
    background: #fef2f2;
}

.qb-tone-footer {
    grid-column: 1 / -1;
    display: none;  /* skjul i kompakt-grid — regen-knap flyttes til modal-header */
}

/* ============================================================ */
/*  Single-page kunde-flow (drop wizard)                         */
/*                                                                */
/*  Designprincippet: alle 4 sektioner altid synlige. Ingen       */
/*  visibility-toggle. JS er progressive enhancement, ikke        */
/*  load-bearing. Hvis JS fejler er siden stadig brugbar (form-   */
/*  elementer er fortsat klikbare).                               */
/* ============================================================ */

.pp-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 22px 24px;
    margin-bottom: 16px;
}
.pp-section-h {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 6px 0;
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}
.pp-section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}
.pp-section-help {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #64748b;
    line-height: 1.55;
    margin: 0 0 16px 40px;  /* indrykket under nummeret */
}

/* Stort segmented control (Studio / Scene) */
.pp-segmented {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 460px;
}
.pp-segmented-option {
    flex: 1;
    padding: 12px 18px;
    border: 0;
    background: transparent;
    color: #475569;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.pp-segmented-option:hover { color: #0f172a; }
.pp-segmented-option.active {
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

/* Konsistent kort-grid + tile (genbruges af swatches, scenes, framings) */
.pp-card-grid {
    display: grid;
    gap: 12px;
}
.pp-card-grid--swatches { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pp-card-grid--scenes   { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pp-card-grid--framing  { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.pp-card-grid--outfits  { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.pp-card-tile {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.pp-card-tile:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}
.pp-card-tile.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.pp-card-tile-img {
    width: 100%;
    display: block;
    background: #f3f4f6;
    object-fit: cover;
}
.pp-card-tile--portrait .pp-card-tile-img { aspect-ratio: 2 / 3; }
.pp-card-tile--landscape .pp-card-tile-img { aspect-ratio: 3 / 2; }
.pp-card-tile-body {
    padding: 8px 10px 10px;
    text-align: center;
}
.pp-card-tile-name {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}
.pp-card-tile-desc {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.4;
}

/* Sticky generate-bar (alltid synlig, mobile-sticky) */
.pp-generate-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 24px;
    margin: 24px 0 16px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.04);
    z-index: 10;
}
.pp-generate-bar-row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.pp-generate-bar .pp-recap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.pp-recap-thumbs {
    display: flex;
    gap: 6px;
}
.pp-recap-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}
.pp-recap-text {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.pp-generate-bar .pp-btn {
    flex-shrink: 0;
    font-size: 15px;
    padding: 12px 28px;
}
.pp-generate-hint {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
    text-align: right;
}
.pp-generate-hint--ready { color: #047857; }

@media (max-width: 700px) {
    .pp-section { padding: 18px 16px; }
    .pp-section-help { margin-left: 0; }
    .pp-segmented { max-width: 100%; }
    .pp-card-grid--swatches { grid-template-columns: repeat(2, 1fr); }
    .pp-card-grid--scenes   { grid-template-columns: 1fr; }
    .pp-card-grid--framing  { grid-template-columns: repeat(2, 1fr); }
    .pp-card-grid--outfits  { grid-template-columns: repeat(2, 1fr); }
    .pp-generate-bar { padding: 14px 16px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .pp-generate-bar-row { flex-direction: column; align-items: stretch; gap: 12px; }
    .pp-generate-bar .pp-btn { width: 100%; }
    .pp-recap-text { white-space: normal; }
    .pp-generate-hint { text-align: center; }
}

/* ============================================================
 * MOBILE APP SHELL — topbar, drawer, install-banner, safe areas
 * Mobile-first; desktop overrides via @media (min-width: 760px).
 * ============================================================ */

/* Safe-area + scroll lock when drawer open */
body.app-layout {
    -webkit-tap-highlight-color: transparent;
}
body.has-drawer-open {
    overflow: hidden;
    touch-action: none;
}
body.is-standalone .app-shell {
    /* When launched as PWA, give topbar room above the iOS status bar */
    padding-top: env(safe-area-inset-top);
}

/* Topbar — mobile-first */
.app-topbar {
    /* Override the hand-rolled flex above for fine-grained mobile layout */
    display: grid;
    grid-template-columns: 44px 1fr auto 44px;
    align-items: center;
    column-gap: 8px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    min-height: 52px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 50;
}
.app-topbar .brand {
    grid-column: 2;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-back, .app-back-spacer {
    grid-column: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #374151;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
}
.app-back:hover, .app-back:focus { background: #f3f4f6; outline: none; }
.app-back:active { background: #e5e7eb; }
.app-back-spacer { pointer-events: none; }

.app-menu-toggle {
    grid-column: 4;
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
}
.app-menu-toggle:hover, .app-menu-toggle:focus { background: #f3f4f6; outline: none; }
.app-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #111827;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}
body.has-drawer-open .app-menu-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
body.has-drawer-open .app-menu-toggle span:nth-child(2) { opacity: 0; }
body.has-drawer-open .app-menu-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.app-topbar-nav { display: none; }
.app-topbar-nav .user-chip { display: none; }

/* Drawer */
.app-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.app-drawer-backdrop.is-open { opacity: 1; }
.app-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(86vw, 320px);
    background: #fff;
    z-index: 100;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}
.app-drawer.is-open { transform: translateX(0); }
.app-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    gap: 12px;
}
.app-drawer__user-name {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}
.app-drawer__user-email {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}
.app-drawer__brand {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}
.app-drawer__close {
    width: 40px; height: 40px;
    border: none;
    background: transparent;
    color: #4b5563;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.app-drawer__close:hover { background: #f3f4f6; }
.app-drawer__nav {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
}
.app-drawer__nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    min-height: 48px;
    text-decoration: none;
    color: #1f2937;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    border-radius: 10px;
}
.app-drawer__nav a:hover, .app-drawer__nav a:focus { background: #f3f4f6; outline: none; }
.app-drawer__nav a:active { background: #e5e7eb; }
.app-drawer__nav a i {
    width: 22px;
    text-align: center;
    color: #6b7280;
    font-size: 16px;
}
.app-drawer__nav a.app-drawer__logout { color: #b91c1c; }
.app-drawer__nav a.app-drawer__logout i { color: #b91c1c; }
.app-drawer__nav a.app-drawer__cta {
    background: #111827;
    color: #fff;
    justify-content: center;
    margin-top: 8px;
}
.app-drawer__divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 4px;
}

/* Install banner */
.app-install-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #111827;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
}
.app-install-banner__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.app-install-banner__text strong { font-weight: 600; }
.app-install-banner__text span { font-size: 12px; opacity: 0.78; }
.app-install-banner__primary {
    background: #fff;
    color: #111827;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-height: 40px;
}
.app-install-banner__close {
    background: transparent;
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    opacity: 0.7;
    flex-shrink: 0;
}
.app-install-banner__close:hover { opacity: 1; background: rgba(255,255,255,0.1); }

/* iOS form-zoom fix: inputs ≥16px font */
@media (max-width: 760px) {
    input, select, textarea {
        font-size: 16px;
    }
    .pp-container { padding: 20px 16px; }
}

/* ============================================================
 * VARIANT PICKER — desktop 3-col grid, mobile segmented switcher
 * ============================================================ */

.pp-variant-help {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #475569;
    margin: 0 0 16px 0;
    line-height: 1.55;
}

/* Desktop 3-col grid (default — overridden on mobile below) */
.pp-variant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.pp-variant-card {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.pp-variant-card--reference {
    border-color: #fcd34d;
}
.pp-variant-card--recommended {
    border-color: #16a34a;
    box-shadow: 0 0 0 1px #16a34a, 0 4px 10px rgba(22, 163, 74, 0.12);
}
.pp-variant-card__header {
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}
.pp-variant-card--reference .pp-variant-card__header {
    background: #fef3c7;
    border-bottom-color: #fcd34d;
}
.pp-variant-card__title {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}
.pp-variant-card--reference .pp-variant-card__title { color: #78350f; }
.pp-variant-card__desc {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}
.pp-variant-card--reference .pp-variant-card__desc { color: #92400e; }
.pp-variant-card__img-wrap {
    position: relative;
    background: #000;
}
.pp-variant-card__img {
    width: 100%;
    display: block;
    background: #000;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}
.pp-variant-card__actions {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pp-variant-card__select { width: 100%; min-height: 44px; }
.pp-variant-card__refine { width: 100%; min-height: 44px; font-size: 12px; }
.pp-variant-card__ref-note {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #92400e;
    text-align: center;
    padding: 6px;
}

/* Segmented switcher — hidden on desktop, visible on mobile */
.pp-variant-segmented {
    display: none;
}

/* ----- Mobile breakpoint (<700px) ----- */
@media (max-width: 699px) {
    .pp-variant-segmented {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        gap: 4px;
        background: #f1f5f9;
        border-radius: 10px;
        padding: 4px;
        margin-bottom: 14px;
        position: sticky;
        top: calc(52px + env(safe-area-inset-top));
        z-index: 30;
    }
    .pp-variant-seg {
        background: transparent;
        border: none;
        padding: 10px 8px;
        min-height: 40px;
        font-family: 'Inter', sans-serif;
        font-size: 13px;
        font-weight: 600;
        color: #475569;
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    }
    .pp-variant-seg.is-active {
        background: #fff;
        color: #111827;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    }

    .pp-variant-grid {
        display: block;
        position: relative;
        touch-action: pan-y;
    }
    .pp-variant-grid .pp-variant-card { display: none; }
    .pp-variant-grid[data-active-variant="a"]   .pp-variant-card[data-variant-key="a"],
    .pp-variant-grid[data-active-variant="ref"] .pp-variant-card[data-variant-key="ref"],
    .pp-variant-grid[data-active-variant="b"]   .pp-variant-card[data-variant-key="b"] {
        display: flex;
        animation: pp-variant-fade 0.2s ease-out;
    }
    @keyframes pp-variant-fade {
        from { opacity: 0.4; }
        to   { opacity: 1; }
    }
    /* Larger image on mobile (more screen real estate per variant) */
    .pp-variant-card__img { aspect-ratio: 3 / 4; }

    /* Sticky CTA bar at bottom of variant area */
    .pp-variant-card__actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 12px 14px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid #f1f5f9;
        box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.04);
    }
    .pp-variant-card__select { min-height: 48px; font-size: 15px; }
    .pp-variant-card__refine { min-height: 44px; font-size: 13px; }
}

/* ----- Desktop overrides (≥760px) ----- */
@media (min-width: 760px) {
    .app-topbar {
        display: flex;
        grid-template-columns: none;
        align-items: center;
        justify-content: space-between;
        padding: 14px 24px;
        padding-top: 14px;
        min-height: auto;
        position: static;
    }
    .app-back, .app-back-spacer { display: none; }
    .app-menu-toggle { display: none; }
    .app-topbar .brand { text-align: left; grid-column: auto; }
    .app-topbar-nav {
        display: flex;
        gap: 22px;
        align-items: center;
    }
    .app-topbar-nav a {
        color: #475569;
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
        position: relative;
        padding: 6px 0;
    }
    .app-topbar-nav a:hover { color: #0f172a; }
    .app-topbar-nav .user-chip {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 4px 10px 4px 4px;
        background: #f1f5f9;
        border-radius: 999px;
        font-size: 13px;
        color: #0f172a;
        font-weight: 500;
        margin-left: 4px;
    }
    .app-topbar-nav .user-chip .user-chip__avatar {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: #4f46e5;
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.3px;
    }
    .app-topbar-nav .user-chip .user-chip__name {
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .app-topbar-logout { padding: 6px 12px; }
    .app-topbar-cta { padding: 6px 12px; }

    /* Hide drawer entirely on desktop */
    .app-drawer, .app-drawer-backdrop { display: none !important; }
}

/* ============================================================
 * MOBILE POLISH — touch targets, dashboard reflow, auth, forms
 * ============================================================ */
@media (max-width: 760px) {
    /* All buttons: 44px min touch target */
    .pp-btn {
        min-height: 44px;
        padding: 10px 18px;
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    /* Inputs: bigger tap area, 16px font (already set above) */
    .pp-input { padding: 12px 14px; min-height: 44px; }

    /* Auth-cards: less padding, full-width on phone */
    .auth-wrap { padding: 16px; }
    .auth-card { padding: 24px 20px; box-shadow: none; border-radius: 14px; }
    .auth-card h1 { font-size: 22px; }

    /* Dashboard card head: stack title above CTA, both full width */
    .pp-card-head-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .pp-card-head-row h2 { margin: 0; }
    .pp-card-head-row form { display: flex; }
    .pp-card-head-row .pp-btn { flex: 1; }

    /* Job rows: reflow to 2-line stacked layout for readability */
    .pp-job-row {
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        padding: 14px 12px;
        font-size: 14px;
    }
    .pp-job-row a {
        flex: 1 1 100%;
        min-width: 0;
        font-size: 15px;
        font-weight: 600;
        line-height: 1.3;
        order: 1;
    }
    .pp-job-row .pp-pill { order: 2; }
    .pp-job-row .pp-job-meta { order: 3; font-size: 12px; }
    .pp-job-row .pp-job-meta[style*="margin-left:auto"] {
        margin-left: 0 !important;
        flex: 1 1 100%;
        order: 4;
    }
    .pp-pill { font-size: 10px; padding: 3px 9px; }

    /* Generic card padding tighter */
    .pp-card { padding: 18px 16px; }

    /* Header reductions */
    .pp-header h1 { font-size: 22px; line-height: 1.25; }
    .pp-header p  { font-size: 13px; }
    .pp-breadcrumb { font-size: 12px; }
}

/* Larger min-tap-targets for all interactive elements on touch devices */
@media (hover: none) and (pointer: coarse) {
    a.pp-btn, button.pp-btn, .pp-btn { min-height: 44px; }
}


/* Bake-off rating-grid (admin/views/bakeoff_run.php) */
.bf-rating-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    outline: none;
}
.bf-rating-grid:focus-within {
    background: #f8fafc;
    border-radius: 4px;
}
.bf-rating-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 12px;
}
.bf-rating-row > span {
    flex: 1;
    color: #475569;
}
.bf-rating-row > span:first-child:not(:only-child) {
    min-width: 110px;
}
.bf-rating-row button[data-verdict] {
    padding: 4px 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
    min-width: 32px;
    transition: all 0.1s;
}
.bf-rating-row button[data-verdict]:hover {
    border-color: #94a3b8;
}
.bf-rating-row button[data-verdict].selected {
    background: #0f172a;
    color: #f8fafc;
    border-color: #0f172a;
    font-weight: 600;
}
.bf-bulk-btn:hover {
    filter: brightness(0.95);
}


/* ============================================================
 * DASHBOARD 2.0 — hero stats, job cards with thumbnails
 * Status-badge system, empty state, banner consolidation.
 * Solid colors only, no gradients.
 * ============================================================ */

/* Page surface — softer than #f3f4f6, slightly cooler. */
body.app-layout { background-color: #f5f6fb !important; }

/* Wider container for grid breathing room */
.pp-container.pp-container--wide { max-width: 1280px; }

/* ----- Hero strip ----- */

.pp-hero {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 28px 32px;
    margin: 0 0 24px 0;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.pp-hero__top {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
}
.pp-hero__title { margin: 0; font-size: 26px; font-weight: 700; color: #0f172a; letter-spacing: -0.3px; }
.pp-hero__subtitle { margin: 4px 0 0 0; font-size: 14px; color: #64748b; }
.pp-hero__org-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eef2ff; color: #4338ca;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
    margin-top: 6px;
}
.pp-hero__org-tag i { font-size: 10px; }

.pp-hero__actions { display: flex; gap: 10px; flex-shrink: 0; }

.pp-hero__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid #f1f5f9;
}
.pp-stat__label {
    font-size: 11px; font-weight: 600; letter-spacing: 1px;
    text-transform: uppercase; color: #94a3b8;
    margin: 0 0 6px 0;
}
.pp-stat__value {
    font-size: 24px; font-weight: 700; color: #0f172a;
    line-height: 1.1; letter-spacing: -0.2px;
    display: flex; align-items: baseline; gap: 6px;
}
.pp-stat__value-suffix { font-size: 14px; font-weight: 500; color: #64748b; }
.pp-stat__bar {
    height: 4px; background: #e5e7eb; border-radius: 2px;
    margin-top: 8px; overflow: hidden;
}
.pp-stat__bar-fill { display: block; height: 100%; background: #4f46e5; border-radius: 2px; transition: width 0.3s ease; }
.pp-stat__bar-fill--warn { background: #f59e0b; }
.pp-stat__bar-fill--danger { background: #dc2626; }

/* ----- Section header on dashboard ----- */
.pp-section-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin: 0 0 14px 0;
}
.pp-section-bar h2 { margin: 0; font-size: 16px; font-weight: 600; color: #0f172a; }
.pp-section-bar .pp-help { margin: 2px 0 0 0; }

/* ----- Job card grid ----- */

.pp-jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.pp-job-card {
    position: relative;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.pp-job-card:hover {
    transform: translateY(-1px);
    border-color: #c7d2fe;
    box-shadow: 0 8px 24px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
}

.pp-job-card__media {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f1f5f9;
    aspect-ratio: 16/9;
    overflow: hidden;
    position: relative;
}
.pp-job-card__media-cell {
    position: relative;
    overflow: hidden;
    background: #e5e7eb;
}
.pp-job-card__media-cell img {
    width: 100%; height: 100%; display: block;
    object-fit: cover;
}
.pp-job-card__media-cell--placeholder {
    display: flex; align-items: center; justify-content: center;
    color: #cbd5e1;
    font-size: 28px;
    background: repeating-linear-gradient(
        45deg, #f8fafc 0, #f8fafc 8px, #f1f5f9 8px, #f1f5f9 16px
    );
}
.pp-job-card__media-arrow {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 28px; height: 28px;
    background: rgba(15,23,42,0.78);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    pointer-events: none;
}

/* Single-image media for jobs without a generated preview yet */
.pp-job-card__media--single { grid-template-columns: 1fr; }
.pp-job-card__media--single .pp-job-card__media-arrow { display: none; }

.pp-job-card__body {
    padding: 14px 16px 16px 16px;
}
.pp-job-card__head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; margin-bottom: 6px;
}
.pp-job-card__title {
    font-size: 15px; font-weight: 600; color: #0f172a;
    margin: 0; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1; min-width: 0;
}
.pp-job-card__title--unnamed { color: #94a3b8; font-style: italic; font-weight: 500; }
.pp-job-card__id {
    font-size: 11px; color: #94a3b8;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    padding-top: 1px;
}
.pp-job-card__meta {
    display: flex; align-items: center; gap: 6px 12px;
    font-size: 12px; color: #64748b;
    flex-wrap: wrap;
    margin-top: 8px;
}
.pp-job-card__meta-dot { color: #cbd5e1; }
.pp-job-card__date { font-variant-numeric: tabular-nums; }

/* ----- Status badge (replaces .pp-pill in dashboard cards) ----- */

.pp-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1px;
    line-height: 1.4;
    white-space: nowrap;
}
.pp-status i { font-size: 9px; }
.pp-status--neutral { background: #f1f5f9; color: #475569; }
.pp-status--info    { background: #eff6ff; color: #1d4ed8; }
.pp-status--warning { background: #fffbeb; color: #b45309; }
.pp-status--success { background: #ecfdf5; color: #047857; }
.pp-status--accent  { background: #f5f3ff; color: #6d28d9; }
.pp-status--danger  { background: #fef2f2; color: #b91c1c; }

/* Pulsing dot for in-progress states */
.pp-status--warning i.fa-spinner { font-size: 10px; }

/* ----- Empty state ----- */

.pp-empty {
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 48px 32px;
    text-align: center;
}
.pp-empty__icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #eef2ff;
    color: #4338ca;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}
.pp-empty__title { margin: 0 0 6px 0; font-size: 18px; font-weight: 600; color: #0f172a; }
.pp-empty__body  { margin: 0 auto 18px auto; max-width: 480px; font-size: 14px; color: #64748b; line-height: 1.55; }

/* ----- Topbar refinements ----- */

.app-topbar { background: #ffffff; border-bottom: 1px solid #eef0f5; }
.app-topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #0f172a;
    text-decoration: none;
}
.app-topbar .brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    flex-shrink: 0;
}
.app-topbar .brand-text {
    font-size: 15px;
    line-height: 1;
}

.app-topbar-balance {
    display: none;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    color: #0f172a;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease;
}
.app-topbar-balance:hover { background: #e2e8f0; }
.app-topbar-balance__dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
.app-topbar-balance__dot--low { background: #f59e0b; }
.app-topbar-balance__dot--empty { background: #dc2626; }

@media (min-width: 760px) {
    .app-topbar-balance { display: inline-flex; }
}

/* ----- Banner consolidation ----- */

/* Slimmer impersonation banner (override the inline-style version above) */
.app-layout > .impersonation-banner { padding: 6px 16px !important; font-size: 12px !important; }
.app-layout > .impersonation-banner .impersonation-banner__label { padding: 1px 6px !important; font-size: 10px !important; }
.app-layout > .impersonation-banner .impersonation-banner__stop { padding: 3px 10px !important; font-size: 11px !important; }

/* Slimmer install banner */
.app-install-banner { padding: 8px 14px; font-size: 12px; }
.app-install-banner__text strong { font-size: 12px; }
.app-install-banner__text span { font-size: 11px; }
.app-install-banner__primary { padding: 6px 12px; font-size: 12px; min-height: 32px; }

/* ----- Mobile tweaks for new dashboard ----- */

@media (max-width: 760px) {
    .pp-hero { padding: 20px 18px; border-radius: 14px; }
    .pp-hero__title { font-size: 20px; }
    .pp-hero__stats { gap: 12px; padding-top: 16px; margin-top: 16px; }
    .pp-stat__value { font-size: 20px; }
    .pp-jobs-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .pp-job-card__body { padding: 10px 12px 12px 12px; }
    .pp-job-card__title { font-size: 13px; }
    .pp-job-card__meta { font-size: 11px; }
    .pp-empty { padding: 32px 20px; }
}
@media (max-width: 480px) {
    .pp-jobs-grid { grid-template-columns: 1fr; }
}

/* ============================================================
 * PhotoOpus theme overrides — editorial paper + burnished gold
 * Applied last so the cascade wins. Light cream surfaces, deep ink
 * type, restrained champagne accent.
 * ============================================================ */

body.app-layout {
    background-color: var(--po-surface) !important;
    color: var(--po-ink);
    font-family: var(--po-font-sans);
}

/* Topbar */
.app-topbar {
    background: #fbf8f1 !important;
    border-bottom: 1px solid var(--po-hairline) !important;
    color: var(--po-ink);
}
.app-topbar a, .app-topbar .nav-link, .app-topbar .brand,
.app-topbar .brand-text, .app-topbar .user-chip {
    color: var(--po-ink) !important;
}
.app-topbar a:hover, .app-topbar .nav-link:hover { color: var(--po-champagne) !important; }
.app-topbar .brand-mark { color: var(--po-ink); }

.app-drawer {
    background: #fbf8f1 !important;
    border-right: 1px solid var(--po-hairline) !important;
}
.app-drawer a { color: var(--po-paper-dim) !important; }
.app-drawer a:hover, .app-drawer a.is-active { color: var(--po-ink) !important; }

/* Flash messages */
.app-flash { border-left-width: 2px !important; border-style: solid !important; border-radius: var(--radius-sm) !important; padding: var(--space-3) var(--space-4) !important; }
.app-flash.error { border-left-color: var(--po-signal) !important; color: var(--po-signal) !important; background: var(--po-signal-soft) !important; border-color: var(--po-signal-soft) !important; }
.app-flash.ok    { border-left-color: var(--po-good) !important;   color: var(--po-good) !important;   background: var(--po-good-soft) !important;   border-color: var(--po-good-soft) !important; }
.app-flash.info  { border-left-color: var(--po-champagne) !important; color: var(--po-champagne) !important; background: var(--po-champagne-soft) !important; border-color: var(--po-champagne-soft) !important; }

/* Cards / containers */
.po-card, .pp-card,
.pp-job-card, .pp-style-card, .pp-bg-card, .pp-framing-card,
.pp-hero, .pp-stat,
.auth-card {
    background: #fbf8f1 !important;
    border: 1px solid var(--po-hairline) !important;
    color: var(--po-ink);
}
.pp-card h1, .pp-card h2, .pp-card h3,
.pp-hero__title, .pp-job-card__title,
.po-header h1, .po-header h2, .pp-header h1, .pp-header h2,
.app-layout h1, .app-layout h2, .app-layout h3 {
    font-family: var(--po-font-display) !important;
    color: var(--po-ink) !important;
    font-weight: 400 !important;
    letter-spacing: -0.01em !important;
}
.app-layout h1 { font-weight: 500 !important; }

/* Dropzone */
.pp-dropzone {
    background: #fbf8f1 !important;
    border: 2px dashed var(--po-hairline-2) !important;
    color: var(--po-paper-dim) !important;
}
.pp-dropzone:hover, .pp-dropzone.is-drag {
    border-color: var(--po-champagne) !important;
    background: var(--po-champagne-soft) !important;
    color: var(--po-champagne) !important;
}

/* Thumbnails */
.pp-thumb, .pp-preview {
    background: var(--po-surface-3) !important;
    border: 1px solid var(--po-hairline) !important;
}
.pp-thumb.primary, .pp-preview.is-selected {
    border-color: var(--po-champagne) !important;
    box-shadow: 0 0 0 2px var(--po-champagne-soft) !important;
}

/* Style/bg/framing card selected state */
.pp-style-card.is-selected, .pp-bg-card.is-selected, .pp-framing-card.is-selected,
[aria-selected="true"] {
    border-color: var(--po-champagne) !important;
    box-shadow: 0 0 0 2px var(--po-champagne-soft) !important;
}

/* Pills */
.pp-pill {
    border: 1px solid var(--po-hairline) !important;
    background: #fbf8f1 !important;
    color: var(--po-paper-dim) !important;
    font-family: var(--po-font-sans) !important;
}
.pp-pill-draft { color: var(--po-paper-dim) !important; }
.pp-pill-generating { color: var(--po-champagne) !important; border-color: var(--po-champagne) !important; }
.pp-pill-preview-ready, .pp-pill-selected, .pp-pill-exported { color: var(--po-good) !important; border-color: var(--po-good) !important; }
.pp-pill-failed { color: var(--po-signal) !important; border-color: var(--po-signal) !important; }

/* Role dots */
.pp-role-dot.identity_reference   { background: var(--po-champagne) !important; }
.pp-role-dot.style_reference      { background: var(--po-good) !important; }
.pp-role-dot.background_reference { background: #b8862b !important; }
.pp-role-dot.failed_comparison    { background: var(--po-signal) !important; }

/* Buttons — ink primary on cream */
.pp-btn,
.po-btn,
button.primary,
button[type="submit"]:not(.btn--secondary):not(.btn--ghost):not(.pp-btn-link),
.btn-primary {
    background: var(--po-ink) !important;
    color: var(--po-surface) !important;
    border: none !important;
    border-radius: 999px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
    font-family: var(--po-font-sans) !important;
}
.pp-btn:hover, .po-btn:hover, button.primary:hover { background: var(--po-champagne) !important; color: var(--po-surface) !important; }
.pp-btn.secondary, .po-btn.secondary, button.secondary {
    background: transparent !important;
    color: var(--po-ink) !important;
    border: 1px solid var(--po-hairline-2) !important;
}
.pp-btn.secondary:hover, .po-btn.secondary:hover { border-color: var(--po-champagne) !important; background: var(--po-champagne-soft) !important; }
.pp-btn.danger, .po-btn.danger { background: var(--po-signal) !important; color: var(--po-surface) !important; }
.pp-btn:disabled, .po-btn:disabled { background: var(--po-surface-3) !important; color: var(--po-ink-muted) !important; cursor: not-allowed !important; }

/* Form fields */
.app-layout input[type="text"], .app-layout input[type="email"],
.app-layout input[type="password"], .app-layout input[type="number"],
.app-layout input[type="tel"], .app-layout input[type="search"],
.app-layout textarea, .app-layout select {
    background: #fbf8f1 !important;
    color: var(--po-ink) !important;
    border: 1px solid var(--po-hairline-2) !important;
    border-radius: var(--radius-sm) !important;
    font-family: var(--po-font-sans) !important;
}
.app-layout input:focus, .app-layout textarea:focus, .app-layout select:focus {
    outline: none !important;
    border-color: var(--po-champagne) !important;
    box-shadow: 0 0 0 3px var(--po-champagne-soft) !important;
}
.app-layout label, .pp-label {
    color: var(--po-champagne) !important;
    font-size: 11px !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    font-family: var(--po-font-sans) !important;
}

/* Auth */
.auth-wrap, .pp-auth-wrap {
    background: var(--po-surface) !important;
    color: var(--po-ink);
}

/* Tables */
.app-layout table { color: var(--po-ink); border-collapse: collapse; }
.app-layout th { color: var(--po-champagne) !important; font-weight: 600 !important; letter-spacing: 0.08em !important; text-transform: uppercase !important; font-size: 11px !important; border-bottom: 1px solid var(--po-hairline) !important; }
.app-layout td { border-bottom: 1px solid var(--po-hairline) !important; color: var(--po-paper-dim); }
.app-layout tr:hover td { background: #fbf8f1; }

/* Admin layout — was dark blue, swap to cream */
body.admin-layout {
    background: var(--po-surface) !important;
    color: var(--po-ink);
    font-family: var(--po-font-sans);
}
body.admin-layout .brand,
body.admin-layout .brand a {
    color: var(--po-ink) !important;
    font-family: var(--po-font-display) !important;
    font-weight: 400 !important;
}
body.admin-layout h1, body.admin-layout h2, body.admin-layout h3 {
    color: var(--po-ink) !important;
    font-family: var(--po-font-display) !important;
}
body.admin-layout .brand .badge,
body.admin-layout .badge {
    background: var(--po-champagne) !important;
    color: var(--po-surface) !important;
    font-family: var(--po-font-sans) !important;
    font-weight: 700 !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    font-size: 10px !important;
}
body.admin-layout .topbar, body.admin-layout .admin-topbar {
    background: #fbf8f1 !important;
    border-bottom: 1px solid var(--po-hairline) !important;
}
body.admin-layout nav a { color: var(--po-paper-dim) !important; }
body.admin-layout nav a:hover { color: var(--po-ink) !important; }
body.admin-layout nav a.is-active { color: var(--po-ink) !important; border-bottom: 1px solid var(--po-champagne); }

::selection { background: var(--po-champagne); color: var(--po-surface); }
