/* ============================================================
   5-modals.css
   Bundle 5/5 — Shared modal & component styles
   Nguồn gốc: ai-components.css (BỎ :root đã vào 1-base)
             + gallery-detail-modal.css + book-preview-panel.css
   Dùng cả Canvas lẫn Admin — load trong App.razor.
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   ai-components.css — aireq-*, gallery-*, gen-* components
   LƯU Ý: :root vars (--ai-*) đã chuyển sang 1-base.css
══════════════════════════════════════════════════════════ */

/* ============================================================
   GENERATE MODAL — phần canvas-ai.css CHƯA có
   (approval flow, submitted step, user info box, admin badge)
   ============================================================ */

.gen-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .gen-body {
        grid-template-columns: 1fr;
    }
}

.gen-left, .gen-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Preview wrap (canvas-ai có gen-preview-img-wrap, đây khác — dùng aspect-ratio 1:1) */
.gen-preview-wrap {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: var(--ai-radius);
    overflow: hidden;
    border: 1px solid var(--border, #e5e7eb);
}

/* Model dot nhỏ (canvas-ai dùng gen-model-icon hình vuông lớn hơn) */
.gen-model-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

    .gen-model-dot.gemini {
        background: #4285f4;
    }

    .gen-model-dot.openai {
        background: #10a37f;
    }

/* Approval notice */
.gen-approval-notice {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    background: var(--bg-secondary, #f3f4f6);
    border-radius: var(--ai-radius);
    padding: 10px 12px;
    margin-top: 4px;
    line-height: 1.5;
}

    .gen-approval-notice svg {
        flex-shrink: 0;
        margin-top: 1px;
        opacity: .7;
    }

/* Admin badge */
.gen-admin-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #4338ca;
    background: #ede9fe;
    border-radius: var(--ai-radius);
    padding: 7px 11px;
    margin-top: 8px;
}

/* User info box */
.gen-user-info-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: var(--ai-radius-lg);
    border: 1px solid var(--border, #e5e7eb);
    height: 100%;
    justify-content: center;
}

.gen-user-info-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #111827);
}

.gen-user-info-desc {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    line-height: 1.6;
    max-width: 240px;
}

.gen-user-info-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    width: 100%;
    max-width: 240px;
    margin-top: 4px;
}

.gen-user-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.gen-user-step-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ede9fe;
    color: #4338ca;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Submitted step */
.gen-submitted-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 24px 20px;
    gap: 12px;
}

.gen-submitted-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f0fdf4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #22c55e;
}

.gen-submitted-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary, #111827);
}

.gen-submitted-sub {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    line-height: 1.6;
    max-width: 320px;
}

.gen-submitted-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.gen-submitted-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
}

    .gen-submitted-badge.pending {
        background: var(--ai-pending-bg);
        color: var(--ai-pending-text);
    }

.gen-submitted-model {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.gen-submitted-prompt {
    font-size: 12px;
    font-style: italic;
    color: var(--text-secondary, #6b7280);
    background: var(--bg-secondary, #f3f4f6);
    padding: 8px 14px;
    border-radius: var(--ai-radius);
    max-width: 340px;
    text-align: center;
}

.gen-actions.center {
    justify-content: center;
}

/* gen-spinner.xs size (canvas-ai chỉ có .sm = 20px) */
.gen-spinner.xs {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

/* ============================================================
   BADGE UTILS
   ============================================================ */

/* Generic status badge pill — canvas-ai không có */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 9px;
    border-radius: 12px;
}

    .badge.amber {
        background: var(--ai-pending-bg);
        color: var(--ai-pending-text);
    }

    .badge.green {
        background: var(--ai-completed-bg);
        color: var(--ai-completed-text);
    }

    .badge.pending {
        background: var(--ai-pending-bg);
        color: var(--ai-pending-text);
    }

    .badge.processing {
        background: var(--ai-processing-bg);
        color: var(--ai-processing-text);
    }

    .badge.completed {
        background: var(--ai-completed-bg);
        color: var(--ai-completed-text);
    }

    .badge.rejected {
        background: var(--ai-rejected-bg);
        color: var(--ai-rejected-text);
    }

    .badge.failed {
        background: var(--ai-failed-bg);
        color: var(--ai-failed-text);
    }

/* Nav pending count badge */
.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    margin-left: auto;
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .7;
    }
}

/* Admin model list (dùng flex row, khác gen-model-list của canvas-ai là flex column) */
.aireq-model-list {
    display: flex;
    gap: 6px;
    margin-bottom: 2px;
}

.aireq-model-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: var(--ai-radius, 8px);
    border: 1.5px solid var(--color-border-primary, #e5e7eb);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: var(--color-background-primary, #fff);
    color: var(--color-text-primary, #111827);
    flex: 1;
    font-size: 12px;
    outline: none;
}

    .aireq-model-row:hover {
        border-color: #a5b4fc;
        background: var(--color-background-secondary, #f9fafb);
    }

    .aireq-model-row.selected {
        border-color: #6366f1;
        background: #eef2ff;
        color: #3730a3;
    }

/* ============================================================
   GALLERY POPUP — chỉ những class canvas-ai.css CHƯA có
   ============================================================ */

/* ── Fullscreen overlay mode ── */
.gallery-popup-overlay.fullscreen-mode {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
}

/* ── Popup fullscreen state ── */
.gallery-popup--fullscreen {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    height: 100vh;
    border-radius: 0 !important;
}

/* ── Fullscreen toggle button ── */
.gallery-fullscreen-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

    .gallery-fullscreen-btn:hover {
        background: var(--bg-hover, #f3f4f6);
    }

/* ── Header actions group ── */
.gallery-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Layout switcher group ── */
.gallery-layout-btns {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 6px;
    padding: 2px;
    margin-right: 2px;
}

.gallery-layout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    transition: background .15s, color .15s;
}

    .gallery-layout-btn:hover {
        background: var(--bg-hover, #f3f4f6);
    }

    .gallery-layout-btn.active {
        background: var(--bg-primary, #fff);
        color: var(--text-primary, #111827);
        box-shadow: 0 1px 3px rgba(0,0,0,.08);
    }

/* ── Content wrapper (replaces canvas-ai fixed .gallery-grid) ── */
.gallery-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Fullscreen: content + detail side by side */
.gallery-popup--fullscreen .gallery-content {
    display: flex;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

/* ── Layout: grid (3 col) ── */
.gallery-content.gallery-layout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-content: start;
}

    .gallery-content.gallery-layout-grid .gallery-card-body {
        display: none;
    }

/* ── Layout: grid3 (3 col medium) ── */
.gallery-content.gallery-layout-grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-content: start;
}

    .gallery-content.gallery-layout-grid3 .gallery-card-body {
        display: none;
    }

/* ── Layout: large (2 col, 4:3) ── */
.gallery-content.gallery-layout-large {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-content: start;
}

    .gallery-content.gallery-layout-large .gallery-card-img,
    .gallery-content.gallery-layout-large .gallery-card-img.placeholder {
        aspect-ratio: 4 / 3;
    }

    .gallery-content.gallery-layout-large .gallery-card-body {
        display: none;
    }

/* ── Layout: list (horizontal rows) ── */
.gallery-content.gallery-layout-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-content: start;
}

    .gallery-content.gallery-layout-list .gallery-card {
        flex-direction: row !important;
        align-items: center;
        padding: 8px 10px;
        gap: 10px;
    }

    .gallery-content.gallery-layout-list .gallery-card-img,
    .gallery-content.gallery-layout-list .gallery-card-img.placeholder {
        width: 56px !important;
        height: 56px !important;
        aspect-ratio: unset !important;
        flex-shrink: 0;
        border-radius: 6px;
    }

    .gallery-content.gallery-layout-list .gallery-card-body {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
        min-width: 0;
    }
    /* Reposition status badge trong list mode */
    .gallery-content.gallery-layout-list .gallery-card-status-badge {
        position: static;
        margin-left: auto;
        flex-shrink: 0;
    }

/* ── Card extensions chưa có trong canvas-ai ── */
.gallery-card.status-pending {
    background: #fffdf5;
}

.gallery-card.status-rejected,
.gallery-card.status-failed {
    background: #fff8f8;
}

/* Card body — chỉ show trong list layout */
.gallery-card-body {
    display: none;
}

.gallery-card-source {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status badge (canvas-ai có .gallery-card-status với style khác — đây là class mới) */
.gallery-card-status-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1.5;
    z-index: 1;
}

    .gallery-card-status-badge.pending {
        background: var(--ai-pending-bg);
        color: var(--ai-pending-text);
    }

    .gallery-card-status-badge.processing {
        background: var(--ai-processing-bg);
        color: var(--ai-processing-text);
    }

    .gallery-card-status-badge.completed {
        background: var(--ai-completed-bg);
        color: var(--ai-completed-text);
    }

    .gallery-card-status-badge.rejected {
        background: var(--ai-rejected-bg);
        color: var(--ai-rejected-text);
    }

    .gallery-card-status-badge.failed {
        background: var(--ai-failed-bg);
        color: var(--ai-failed-text);
    }

/* ── Pending: show canvas image inside placeholder ── */
.gallery-card-img.placeholder .pending-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(15%) opacity(.72);
}

.pending-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(to top, rgba(0,0,0,.48) 0%, transparent 55%);
    padding-bottom: 7px;
}

.pending-overlay-label {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,.35);
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: .02em;
}

/* Placeholder tints */
.gallery-card-img.placeholder.pending {
    background: #fef9e7;
}

.gallery-card-img.placeholder.processing {
    background: var(--ai-processing-bg);
}

.gallery-card-img.placeholder.rejected,
.gallery-card-img.placeholder.failed {
    background: var(--ai-rejected-bg);
}

/* ── Gallery detail panel (mới — canvas-ai có gallery-detail-panel khác) ── */
.gallery-detail {
    border-top: 1px solid var(--border, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 38vh;
}

.gallery-popup--fullscreen .gallery-detail {
    border-top: none;
    border-left: 1px solid var(--border, #e5e7eb);
    max-height: unset;
    width: 300px;
    flex-shrink: 0;
}

/* Detail full-res image (khác gallery-detail-col của canvas-ai) */
.gallery-detail-image-wrap {
    position: relative;
    background: var(--bg-secondary, #f3f4f6);
    margin: 12px 14px 0;
    border-radius: var(--ai-radius);
    overflow: hidden;
}

.gallery-detail-img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    display: block;
}

    .gallery-detail-img.pending-canvas-full {
        filter: grayscale(12%) opacity(.82);
    }

.gallery-detail-pending-notice {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
    text-align: center;
}

    .gallery-detail-pending-notice span {
        font-size: 12px;
        font-weight: 600;
        color: #fff;
    }

/* Pending / rejected empty detail */
.gallery-detail-pending,
.gallery-detail-rejected {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 20px 16px;
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
}

    .gallery-detail-pending svg {
        color: var(--ai-pending, #f59e0b);
        opacity: .8;
    }

    .gallery-detail-rejected svg {
        color: var(--ai-rejected, #ef4444);
        opacity: .8;
    }

.gallery-detail-note {
    font-size: 12px;
    font-style: italic;
    background: var(--bg-secondary, #f3f4f6);
    padding: 6px 12px;
    border-radius: var(--ai-radius);
    max-width: 280px;
}

/* gallery-cost-bar: override canvas-ai layout (item stacked → inline) */
.gallery-cost-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    font-size: 12px;
    flex-shrink: 0;
}

.gallery-cost-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #6b7280);
    flex: unset;
    flex-direction: row;
    border-right: none;
    padding: 0;
}

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-primary, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary, #111827);
}

.topbar-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 9px;
    border-radius: 12px;
}

    .topbar-badge.pending {
        background: var(--ai-pending-bg);
        color: var(--ai-pending-text);
    }

.btn-outline {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--bg-primary, #fff);
    border-radius: var(--ai-radius);
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    transition: background .12s;
}

    .btn-outline:hover {
        background: var(--bg-hover, #f3f4f6);
    }

/* ── Summary cards ── */
.aireq-summary-cards {
    display: flex;
    gap: 8px;
    padding: 8px;
    flex-wrap: wrap;
}

.aireq-summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    border-radius: var(--ai-radius);
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border, #e5e7eb);
    min-width: 72px;
    gap: 2px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}

    .aireq-summary-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 10px rgba(0,0,0,.07);
    }

    .aireq-summary-card.filter-active {
        box-shadow: 0 0 0 2px #6366f1;
    }

    .aireq-summary-card .card-num {
        font-size: 20px;
        font-weight: 600;
        line-height: 1.2;
        color: var(--text-primary, #111827);
    }

    .aireq-summary-card .card-label {
        font-size: 11px;
        color: var(--text-secondary, #6b7280);
    }

    .aireq-summary-card.pending {
        border-top: 3px solid var(--ai-pending);
    }

    .aireq-summary-card.processing {
        border-top: 3px solid var(--ai-processing);
    }

    .aireq-summary-card.completed {
        border-top: 3px solid var(--ai-completed);
    }

    .aireq-summary-card.rejected {
        border-top: 3px solid var(--ai-rejected);
    }

    .aireq-summary-card.failed {
        border-top: 3px solid var(--ai-failed);
    }

    .aireq-summary-card.cost {
        border-top: 3px solid #8b5cf6;
    }

        .aireq-summary-card.cost .card-num {
            font-size: 16px;
        }

    .aireq-summary-card.pending .card-num {
        color: var(--ai-pending-text);
    }

    .aireq-summary-card.processing .card-num {
        color: var(--ai-processing-text);
    }

    .aireq-summary-card.completed .card-num {
        color: var(--ai-completed-text);
    }

    .aireq-summary-card.rejected .card-num {
        color: var(--ai-rejected-text);
    }

    .aireq-summary-card.failed .card-num {
        color: var(--ai-failed-text);
    }

.aireq-detail {
    border-left: 1px solid var(--border, #e5e7eb);
    background: var(--bg-primary, #fff);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.aireq-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
}

.aireq-detail-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
}

.aireq-detail-img-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    .aireq-detail-img-col img {
        width: 100%;
        aspect-ratio: 1;
        object-fit: contain;
        border-radius: 6px;
        background: #ffffff;
        border: 1px solid var(--border, #e5e7eb);
    }

.aireq-detail-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border, #e5e7eb);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================================
   DARK MODE
   ============================================================ */

/* Dark mode — dùng html[data-theme=dark] thay vì prefers-color-scheme
   để đồng bộ với adg_theme toggle (không phụ thuộc system setting) */
html[data-theme="dark"] .sidebar-nav .nav-item.active,
.adm-dark .sidebar-nav .nav-item.active {
    background: #2e1065;
    color: #a5b4fc;
}

html[data-theme="dark"] .gallery-layout-btn.active,
.adm-dark .gallery-layout-btn.active {
    background: rgba(255,255,255,.1);
}

html[data-theme="dark"] .aireq-summary-card.filter-active,
.adm-dark .aireq-summary-card.filter-active {
    box-shadow: 0 0 0 2px #a5b4fc;
}

html[data-theme="dark"] .gen-submitted-prompt,
.adm-dark .gen-submitted-prompt {
    background: rgba(255,255,255,.06);
}

/* ── Transparent PNG (Fabric canvas export) — luôn cần white bg ──────────
   Áp dụng cho bất kỳ img nào hiển thị ảnh canvas/result trong các component.
   ─────────────────────────────────────────────────────────────────────── */

/* Gallery popup cards */
.gallery-card-img,
.gallery-card-img.placeholder .pending-canvas {
    background: #ffffff;
}

/* Admin list thumbnail */
.aireq-thumb img {
    background: #ffffff;
}

/* Admin grid card image */
.aireq-grid-img {
    background: #ffffff;
}

/* Admin kanban card thumb */
.kanban-card-thumb img {
    background: #ffffff;
}

/* Admin detail panel — compare images (canvas vs result) */
.aireq-detail-img-col img {
    background: #ffffff !important; /* override dark #222 */
}

/* Gallery detail full-res */
.gallery-detail-img {
    background: #ffffff;
}

/* Checkerboard util class — dùng khi muốn hiện rõ vùng transparent */
.img-transparent-bg {
    background-image: linear-gradient(45deg, #d9d9d9 25%, transparent 25%), linear-gradient(-45deg, #d9d9d9 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d9d9d9 75%), linear-gradient(-45deg, transparent 75%, #d9d9d9 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
    background-color: #f5f5f5;
}

/* ── Animations ── */
@keyframes ai-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================================
   AI REQUEST ADMIN — 3-column layout (Books › Pages › Detail)
   ============================================================ */

/* ── Summary cards: tighter top padding in new layout ── */
.aireq-summary-cards {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

/* ══════════════════════════════════════════════════════════
   3-COLUMN SHELL
══════════════════════════════════════════════════════════ */

.aireq-3col {
    flex: 1;
    display: grid;
    grid-template-columns: 220px 260px 1fr;
    overflow: hidden;
    min-height: 0;
}

.aireq-col-books,
.aireq-col-pages,
.aireq-col-detail {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border, #e5e7eb);
    background: var(--bg-primary, #fff);
}

.aireq-col-detail {
    border-right: none;
}

.aireq-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
    flex-shrink: 0;
}

.aireq-col-header-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aireq-col-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.aireq-col-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    min-height: 120px;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    opacity: .6;
}

/* ══════════════════════════════════════════════════════════
   BOOKS COLUMN — layout toggle
══════════════════════════════════════════════════════════ */

.aireq-books-layout-toggle {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.aireq-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 22px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}

    .aireq-toggle-btn:hover {
        background: var(--bg-hover, #f3f4f6);
        color: var(--text-primary, #111827);
    }

    .aireq-toggle-btn.active {
        background: var(--bg-primary, #fff);
        color: var(--text-primary, #111827);
        border-color: var(--border, #d1d5db);
        box-shadow: 0 1px 3px rgba(0,0,0,.07);
    }

.aireq-books-skeleton,
.aireq-page-skeleton {
    height: 60px;
    margin: 6px 10px;
    border-radius: var(--ai-radius);
    background: linear-gradient(90deg, var(--bg-secondary, #f3f4f6) 25%, #eee 50%, var(--bg-secondary, #f3f4f6) 75%);
    background-size: 200% 100%;
    animation: ai-shimmer 1.4s infinite;
}

/* ── Active state: dùng border-left thay background ── */
/* Book / subbook active: đường kẻ trái + text đậm hơn, không đổi background */

.aireq-user-group {
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.aireq-user-group-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    background: var(--bg-secondary, #f9fafb);
    position: sticky;
    top: 0;
    z-index: 1;
}

.aireq-user-group-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aireq-user-pending-badge {
    font-size: 10px;
    background: var(--ai-rejected-bg, #fef2f2);
    color: var(--ai-rejected-text, #991b1b);
    padding: 1px 6px;
    border-radius: 99px;
    flex-shrink: 0;
}

/* Subbook row */
.aireq-subbook {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 7px 10px 7px 16px;
    cursor: pointer;
    border-top: 1px solid var(--border, #e5e7eb);
    border-left: 3px solid transparent;
    transition: background .12s, border-color .12s;
}

    .aireq-subbook:hover {
        background: var(--bg-hover, #f3f4f6);
    }

    /* Active: border trái nổi bật, background nhẹ hơn */
    .aireq-subbook.active {
        border-left-color: #6366f1;
        background: var(--bg-secondary, #f9fafb);
    }

    .aireq-subbook > svg {
        flex-shrink: 0;
        color: var(--text-secondary, #9ca3af);
        margin-top: 2px;
        transition: color .12s;
    }

    .aireq-subbook.active > svg {
        color: #6366f1;
    }

.aireq-subbook-body {
    flex: 1;
    min-width: 0;
}

.aireq-subbook-name {
    font-size: 12px;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .12s;
}

.aireq-subbook.active .aireq-subbook-name {
    color: #6366f1;
    font-weight: 500;
}

.aireq-subbook-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.aireq-subbook-pages {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
}

.aireq-subbook-pending {
    font-size: 10px;
    background: var(--ai-pending-bg, #fef3c7);
    color: var(--ai-pending-text, #92400e);
    padding: 1px 6px;
    border-radius: 99px;
}

.aireq-pending-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
    margin-top: 6px;
}

/* ── Layout B: flat book list ── */
.aireq-book-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border, #e5e7eb);
    border-left: 3px solid transparent;
    transition: background .12s, border-color .12s;
}

    .aireq-book-item:hover {
        background: var(--bg-hover, #f3f4f6);
    }

    .aireq-book-item.active {
        border-left-color: #6366f1;
        background: var(--bg-secondary, #f9fafb);
    }

.aireq-book-icon {
    flex-shrink: 0;
    color: var(--text-secondary, #9ca3af);
    margin-top: 2px;
    transition: color .12s;
}

.aireq-book-item.active .aireq-book-icon {
    color: #6366f1;
}

.aireq-book-body {
    flex: 1;
    min-width: 0;
}

.aireq-book-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .12s;
}

.aireq-book-item.active .aireq-book-name {
    color: #6366f1;
}

.aireq-book-user-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}

.aireq-book-user-name {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════
   AVATAR
══════════════════════════════════════════════════════════ */

.aireq-avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    font-size: 9px;
}

    .aireq-avatar.xs {
        width: 14px;
        height: 14px;
        font-size: 7px;
    }

    .aireq-avatar.av-blue {
        background: #dbeafe;
        color: #1d4ed8;
    }

    .aireq-avatar.av-teal {
        background: #d1fae5;
        color: #065f46;
    }

    .aireq-avatar.av-amber {
        background: #fef3c7;
        color: #92400e;
    }

    .aireq-avatar.av-coral {
        background: #fee2e2;
        color: #991b1b;
    }

    .aireq-avatar.av-purple {
        background: #ede9fe;
        color: #5b21b6;
    }

/* ══════════════════════════════════════════════════════════
   PAGES COLUMN
══════════════════════════════════════════════════════════ */

.aireq-pages-search-wrap {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
}

.aireq-pages-search {
    width: 100%;
    font-size: 12px;
    padding: 5px 8px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--ai-radius, 8px);
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-primary, #111827);
    outline: none;
    transition: border-color .15s, background .15s;
}

    .aireq-pages-search:focus {
        border-color: #6366f1;
        background: var(--bg-primary, #fff);
    }

/* Page row — border-left cho status, background thay đổi khi active */
.aireq-page-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border, #e5e7eb);
    border-left: 3px solid transparent;
    transition: background .12s, border-color .12s;
    position: relative;
}

    .aireq-page-item:hover {
        background: var(--bg-hover, #f3f4f6);
    }

    /* Active: background nhẹ + border trái indigo */
    .aireq-page-item.active {
        background: var(--bg-secondary, #f9fafb);
        border-left-color: #6366f1;
    }

    /* Status border màu — chỉ khi KHÔNG active */
    .aireq-page-item:not(.active).status-pending {
        border-left-color: var(--ai-pending, #f59e0b);
    }

    .aireq-page-item:not(.active).status-processing {
        border-left-color: var(--ai-processing, #3b82f6);
    }

    .aireq-page-item:not(.active).status-completed {
        border-left-color: var(--ai-completed, #22c55e);
    }

    .aireq-page-item:not(.active).status-rejected,
    .aireq-page-item:not(.active).status-failed {
        border-left-color: var(--ai-rejected, #ef4444);
    }

/* Thumbnail */
.aireq-page-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary, #f3f4f6);
    border: 1px solid var(--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .aireq-page-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        background: #fff;
    }

        .aireq-page-thumb img.thumb-pending {
            filter: grayscale(15%) opacity(.7);
        }

.aireq-page-info {
    flex: 1;
    min-width: 0;
}

.aireq-page-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.aireq-page-prompt {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.aireq-page-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.aireq-page-time {
    font-size: 10px;
    color: var(--text-secondary, #9ca3af);
}

/* Quick approve/reject — hiện khi hover */
.aireq-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s;
}

.aireq-page-item:hover .aireq-quick-actions {
    opacity: 1;
}

/* Status badge (small, inline) */
.aireq-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 10px;
}

    .aireq-badge.pending {
        background: var(--ai-pending-bg);
        color: var(--ai-pending-text);
    }

    .aireq-badge.processing {
        background: var(--ai-processing-bg);
        color: var(--ai-processing-text);
    }

    .aireq-badge.completed {
        background: var(--ai-completed-bg);
        color: var(--ai-completed-text);
    }

    .aireq-badge.rejected {
        background: var(--ai-rejected-bg);
        color: var(--ai-rejected-text);
    }

    .aireq-badge.failed {
        background: var(--ai-failed-bg);
        color: var(--ai-failed-text);
    }

/* ══════════════════════════════════════════════════════════
   DETAIL COLUMN
══════════════════════════════════════════════════════════ */

.aireq-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    opacity: .5;
}

.aireq-detail-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #111827);
}

/* Detail header — sticky, inherits bg */
.aireq-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: var(--bg-primary, #fff);
    position: sticky;
    top: 0;
    z-index: 1;
    flex-shrink: 0;
}

.aireq-detail-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.aireq-detail-page-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Detail images section — neutral bg, no color bleed */
.aireq-detail-images {
    background: var(--bg-secondary, #f9fafb) !important;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

/* Detail meta table rows */
.gallery-detail-meta {
    background: var(--bg-primary, #fff);
    padding: 0;
}

.gallery-detail-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border, #f3f4f6);
    font-size: 12px;
}

    .gallery-detail-row > span:first-child {
        font-size: 11px;
        font-weight: 500;
        color: var(--text-secondary, #6b7280);
        flex-shrink: 0;
        text-transform: uppercase;
        letter-spacing: .03em;
    }

    .gallery-detail-row > span:last-child {
        color: var(--text-primary, #111827);
        text-align: right;
        word-break: break-word;
    }

    .gallery-detail-row.highlight {
        background: var(--bg-secondary, #f9fafb);
    }

        .gallery-detail-row.highlight > span:last-child {
            color: #7c3aed;
            font-weight: 600;
        }

    .gallery-detail-row.error > span:last-child {
        color: #dc2626;
        font-size: 11px;
    }

/* gen-compare-label */
.gen-compare-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 5px 8px 3px;
    display: block;
}

/* ══════════════════════════════════════════════════════════
   DARK MODE — class-based (adm-dark từ AdminLayout)
══════════════════════════════════════════════════════════ */

html[data-theme="dark"] .aireq-subbook.active,
.adm-dark .aireq-subbook.active,
html[data-theme="dark"] .aireq-book-item.active,
.adm-dark .aireq-book-item.active {
    background: rgba(99,102,241,.08);
    border-left-color: #818cf8;
}

    html[data-theme="dark"] .aireq-subbook.active .aireq-subbook-name,
    .adm-dark .aireq-subbook.active .aireq-subbook-name,
    html[data-theme="dark"] .aireq-book-item.active .aireq-book-name,
    .adm-dark .aireq-book-item.active .aireq-book-name {
        color: #818cf8;
    }

    html[data-theme="dark"] .aireq-subbook.active > svg,
    .adm-dark .aireq-subbook.active > svg,
    html[data-theme="dark"] .aireq-book-item.active .aireq-book-icon,
    .adm-dark .aireq-book-item.active .aireq-book-icon {
        color: #818cf8;
    }

html[data-theme="dark"] .aireq-page-item.active,
.adm-dark .aireq-page-item.active {
    background: rgba(99,102,241,.08);
    border-left-color: #818cf8;
}

html[data-theme="dark"] .aireq-toggle-btn.active,
.adm-dark .aireq-toggle-btn.active {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.2);
}

html[data-theme="dark"] .aireq-pages-search,
.adm-dark .aireq-pages-search {
    background: rgba(255,255,255,.05);
    color: var(--text-primary);
    border-color: var(--border);
}

    html[data-theme="dark"] .aireq-pages-search:focus,
    .adm-dark .aireq-pages-search:focus {
        background: rgba(255,255,255,.08);
        border-color: #818cf8;
    }

html[data-theme="dark"] .aireq-detail-inner,
.adm-dark .aireq-detail-inner {
    background: var(--bg-primary);
    color: var(--text-primary);
}

html[data-theme="dark"] .aireq-detail-header,
.adm-dark .aireq-detail-header {
    background: var(--bg-primary);
    border-color: var(--border);
}

html[data-theme="dark"] .aireq-detail-images,
.adm-dark .aireq-detail-images {
    background: var(--bg-secondary) !important;
    border-color: var(--border);
}

html[data-theme="dark"] .gallery-detail-meta,
.adm-dark .gallery-detail-meta {
    background: var(--bg-primary);
}

html[data-theme="dark"] .gallery-detail-row,
.adm-dark .gallery-detail-row {
    border-color: var(--border);
}

    html[data-theme="dark"] .gallery-detail-row > span:last-child,
    .adm-dark .gallery-detail-row > span:last-child {
        color: var(--text-primary);
    }

    html[data-theme="dark"] .gallery-detail-row.highlight,
    .adm-dark .gallery-detail-row.highlight {
        background: rgba(99,102,241,.08);
    }

        html[data-theme="dark"] .gallery-detail-row.highlight > span:last-child,
        .adm-dark .gallery-detail-row.highlight > span:last-child {
            color: #a78bfa;
        }

    html[data-theme="dark"] .gallery-detail-row.error > span:last-child,
    .adm-dark .gallery-detail-row.error > span:last-child {
        color: #f87171;
    }

.adm-topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--border-radius-md);
    border: 0.5px solid var(--border, #e5e7eb);
    background: transparent;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: background .12s;
}

    .adm-topbar-btn:hover {
        background: var(--bg-secondary, #f9fafb);
        color: var(--text-primary, #111827);
    }

    .adm-topbar-btn svg {
        flex-shrink: 0;
    }

.adm-topbar-btn-success {
    border-color: #C0DD97;
    background: #EAF3DE;
    color: #27500A;
}

    .adm-topbar-btn-success:hover {
        opacity: .88;
        background: #EAF3DE;
    }

/* Dark mode */
html[data-theme="dark"] .adm-topbar-btn,
.adm-dark .adm-topbar-btn {
    border-color: var(--border);
}

    html[data-theme="dark"] .adm-topbar-btn:hover,
    .adm-dark .adm-topbar-btn:hover {
        background: var(--bg-hover);
    }

html[data-theme="dark"] .adm-topbar-btn-success,
.adm-dark .adm-topbar-btn-success {
    border-color: rgba(99,153,34,.4);
    background: rgba(99,153,34,.12);
    color: #C0DD97;
}

/* ════════════════════════════════════════════════════════
   APPEND vào cuối ai-components.css
   Book Preview button states trong AIRequestAdmin topbar
   ════════════════════════════════════════════════════════ */

/* Book Preview — trạng thái bình thường */
.btn-preview {
    color: var(--text-secondary, #6b7280);
}

    .btn-preview:hover {
        color: var(--text-primary, #111827);
        background: var(--bg-hover, #f3f4f6);
    }

/* Book Preview — sau khi export thành công (xanh lá) */
.btn-preview-success {
    border-color: #C0DD97 !important;
    background: #EAF3DE !important;
    color: #27500A !important;
}

    .btn-preview-success:hover {
        opacity: .88;
        background: #EAF3DE !important;
    }

/* Dark mode */
html[data-theme="dark"] .btn-preview-success,
.adm-dark .btn-preview-success {
    border-color: rgba(99,153,34,.45) !important;
    background: rgba(99,153,34,.12) !important;
    color: #C0DD97 !important;
}

/* ── Nút Bỏ chọn image ── */
.aireq-btn-unselect-image {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 5px;
    border: 0.5px solid var(--color-border-tertiary, #e5e7eb);
    background: transparent;
    font-size: 11px;
    color: var(--color-text-secondary, #6b7280);
    cursor: pointer;
    transition: background .12s;
}

    .aireq-btn-unselect-image:hover:not(:disabled) {
        background: var(--color-background-secondary, #f9fafb);
        color: var(--color-text-primary, #111827);
    }

    .aireq-btn-unselect-image:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

    .aireq-btn-unselect-image svg {
        flex-shrink: 0;
    }

/* Badge + Bỏ chọn nằm cạnh nhau */
.aireq-select-image-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Dark mode */
html[data-theme="dark"] .aireq-btn-unselect-image,
.adm-dark .aireq-btn-unselect-image {
    border-color: var(--color-border-tertiary, #374151);
    color: var(--color-text-secondary, #9ca3af);
}

    html[data-theme="dark"] .aireq-btn-unselect-image:hover:not(:disabled),
    .adm-dark .aireq-btn-unselect-image:hover:not(:disabled) {
        background: var(--color-background-secondary, #111827);
        color: var(--color-text-primary, #f9fafb);
    }

/* media dark fallback (khi dùng ngoài AdminLayout) */
html[data-theme="dark"] .aireq-pages-search,
.adm-dark .aireq-pages-search {
    background: rgba(255,255,255,.05);
}

/* ══════════════════════════════════════════════════════════
   gallery-detail-modal.css — gdm-* GalleryDetailModal
══════════════════════════════════════════════════════════ */

.gdm-overlay {
    position: fixed;
    inset: 0;
    z-index: 8000; /* dưới ImageViewer (9000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
    outline: none;
}

    .gdm-overlay.gdm-visible {
        background: rgba(0, 0, 0, 0.45);
    }

/* ── Modal container ── */
.gdm-modal {
    width: 100%;
    max-width: 960px;
    max-height: calc(100vh - 32px);
    background: var(--bg-primary, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
    transform: scale(0.97) translateY(8px);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(.25,.46,.45,.94), opacity 0.2s ease;
}

.gdm-visible .gdm-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Header ── */
.gdm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
    background: var(--bg-primary, #ffffff);
}

.gdm-header-left,
.gdm-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gdm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

    .gdm-status-badge.pending {
        background: var(--ai-pending-bg, #fef3c7);
        color: var(--ai-pending-text, #92400e);
    }

    .gdm-status-badge.processing {
        background: var(--ai-processing-bg, #eff6ff);
        color: var(--ai-processing-text, #1e40af);
    }

    .gdm-status-badge.completed {
        background: var(--ai-completed-bg, #f0fdf4);
        color: var(--ai-completed-text, #166534);
    }

    .gdm-status-badge.rejected,
    .gdm-status-badge.failed {
        background: var(--ai-rejected-bg, #fef2f2);
        color: var(--ai-rejected-text, #991b1b);
    }

.gdm-counter {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    background: var(--bg-secondary, #f3f4f6);
    padding: 2px 9px;
    border-radius: 10px;
    font-variant-numeric: tabular-nums;
}

.gdm-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    transition: background .12s, color .12s;
    text-decoration: none;
}

    .gdm-icon-btn:hover {
        background: var(--bg-hover, #f3f4f6);
        color: var(--text-primary, #111827);
    }

    .gdm-icon-btn.gdm-close:hover {
        background: #fee2e2;
        color: #dc2626;
    }

/* ── Body ── */
.gdm-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Images column ── */
.gdm-images-col {
    flex: 1;
    position: relative;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    background-color: #ebebeb;
    background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Images area inside column */
.gdm-images-area {
    flex: 1;
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 20px;
    gap: 16px;
    overflow: auto;
}

    .gdm-images-area.gdm-one-col {
        grid-template-columns: 1fr;
    }

    .gdm-images-area.gdm-two-col {
        grid-template-columns: 1fr 1fr;
    }

@media (max-width: 700px) {
    .gdm-images-area.gdm-two-col {
        grid-template-columns: 1fr;
    }
}

/* Image block */
.gdm-img-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 380px;
}

.gdm-img-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-secondary, #6b7280);
    background: var(--bg-primary, #fff);
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid var(--border, #e5e7eb);
}

.gdm-img-label--result {
    color: #6366f1;
    border-color: #c7d2fe;
    background: #eef2ff;
}

.gdm-img-wrap {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    box-shadow: 0 2px 12px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.06);
    transition: box-shadow .15s, transform .15s;
    background: #fff;
}

    .gdm-img-wrap:hover {
        box-shadow: 0 6px 24px rgba(0,0,0,.16), 0 0 0 1px rgba(99,102,241,.3);
        transform: translateY(-1px);
    }

.gdm-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 220px);
    object-fit: contain;
    background: #ffffff;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Zoom hint on hover */
.gdm-img-zoom-hint {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: rgba(0,0,0,.5);
    padding: 3px 8px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}

.gdm-img-wrap:hover .gdm-img-zoom-hint {
    opacity: 1;
}

/* Placeholder */
.gdm-img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 300px;
    background: var(--bg-secondary, #f9fafb);
    border: 1.5px dashed var(--border, #e5e7eb);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
}

.gdm-img-placeholder--generating {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #6366f1;
}

/* Nav arrows */
.gdm-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--bg-primary, #fff);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: background .15s, border-color .15s, color .15s, transform .15s;
}

    .gdm-nav:hover {
        background: var(--bg-hover, #f3f4f6);
        border-color: #6366f1;
        color: #6366f1;
    }

.gdm-nav-prev {
    left: 10px;
}

.gdm-nav-next {
    right: 10px;
}

.gdm-nav-prev:hover {
    transform: translateY(-50%) translateX(-1px);
}

.gdm-nav-next:hover {
    transform: translateY(-50%) translateX(1px);
}

.gdm-nav-disabled {
    opacity: .2;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Meta column ── */
.gdm-meta-col {
    width: 280px;
    flex-shrink: 0;
    border-left: 1px solid var(--border, #e5e7eb);
    background: var(--bg-primary, #ffffff);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gdm-meta-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

    .gdm-meta-scroll::-webkit-scrollbar {
        width: 4px;
    }

    .gdm-meta-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .gdm-meta-scroll::-webkit-scrollbar-thumb {
        background: var(--border, #e5e7eb);
        border-radius: 2px;
    }

.gdm-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-secondary, #9ca3af);
    margin-bottom: 6px;
}

/* Prompt */
.gdm-prompt-block {
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 10px 12px;
}

.gdm-prompt-text {
    font-size: 13px;
    color: var(--text-primary, #111827);
    line-height: 1.6;
    margin: 0;
    word-break: break-word;
}

/* Info rows */
.gdm-info-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gdm-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border, #f3f4f6);
    font-size: 12px;
}

    .gdm-info-row:last-child {
        border-bottom: none;
    }

.gdm-info-key {
    color: var(--text-secondary, #9ca3af);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 62px;
}

.gdm-info-val {
    color: var(--text-primary, #111827);
    text-align: right;
    word-break: break-word;
}

.gdm-info-val--small {
    font-size: 11px;
}

.gdm-info-row--highlight .gdm-info-val {
    color: #6366f1;
    font-weight: 600;
}

.gdm-info-row--error .gdm-info-val {
    color: #dc2626;
    font-size: 11px;
}

/* Actions */
.gdm-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gdm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background .12s, border-color .12s, opacity .12s;
}

.gdm-btn--primary {
    background: #6366f1;
    color: #fff;
}

    .gdm-btn--primary:hover {
        background: #4f46e5;
    }

.gdm-btn--outline {
    background: transparent;
    border: 1px solid var(--border, #e5e7eb);
    color: var(--text-primary, #111827);
}

    .gdm-btn--outline:hover {
        background: var(--bg-hover, #f3f4f6);
        border-color: #a5b4fc;
    }

/* Thumbnail strip */
.gdm-thumbs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 5px;
}

.gdm-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    background: var(--bg-secondary, #f3f4f6);
    padding: 0;
    opacity: .55;
    transition: opacity .12s, border-color .12s, transform .12s;
}

    .gdm-thumb:hover {
        opacity: .85;
        transform: scale(1.06);
    }

    .gdm-thumb.active {
        border-color: #6366f1;
        opacity: 1;
    }

    .gdm-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        background: #fff;
    }

.gdm-thumb-canvas {
    opacity: .7;
}

/* Status dot on thumbnail */
.gdm-thumb-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid #fff;
}

    .gdm-thumb-dot.pending {
        background: var(--ai-pending, #f59e0b);
    }

    .gdm-thumb-dot.processing {
        background: var(--ai-processing, #3b82f6);
    }

    .gdm-thumb-dot.completed {
        background: var(--ai-completed, #22c55e);
    }

    .gdm-thumb-dot.rejected,
    .gdm-thumb-dot.failed {
        background: var(--ai-rejected, #ef4444);
    }

/* ── Responsive ── */
@media (max-width: 640px) {
    .gdm-modal {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }

    .gdm-overlay {
        padding: 0;
    }

    .gdm-meta-col {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border, #e5e7eb);
    }

    .gdm-body {
        flex-direction: column;
    }

    .gdm-images-col {
        min-height: 260px;
    }
}

/* gen-spinner reuse */
.gdm-img-placeholder .gen-spinner {
    border-top-color: #6366f1;
}

/* ══════════════════════════════════════════════════════════
   book-preview-panel.css — bpp-* BookPreviewPanel drawer
══════════════════════════════════════════════════════════ */


/* ── Backdrop ── */
.bpp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 900;
    animation: bpp-fade .18s ease;
}

@keyframes bpp-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Drawer ── */
.bpp-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 560px;
    max-width: 100vw;
    background: var(--color-background-primary);
    border-left: 0.5px solid var(--color-border-secondary);
    z-index: 901;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: bpp-slide .22s cubic-bezier(.4,0,.2,1);
}

@keyframes bpp-slide {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* ── Header ── */
.bpp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--color-border-tertiary);
    flex-shrink: 0;
}

.bpp-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bpp-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bpp-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bpp-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.5px solid var(--color-border-tertiary);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

    .bpp-close:hover {
        background: var(--color-background-secondary);
        color: var(--color-text-primary);
    }

/* ── Tabs ── */
.bpp-tabs {
    display: flex;
    border-bottom: 0.5px solid var(--color-border-tertiary);
    background: var(--color-background-secondary);
    flex-shrink: 0;
}

.bpp-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--color-text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}

    .bpp-tab:hover {
        color: var(--color-text-primary);
    }

    .bpp-tab.active {
        color: var(--color-text-primary);
        border-bottom-color: #639922;
        font-weight: 500;
    }

    .bpp-tab:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

    .bpp-tab i {
        font-size: 13px;
    }

.bpp-tab-done.active {
    color: #3B6D11;
    border-bottom-color: #3B6D11;
}

.bpp-unsaved-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #EF9F27;
    margin-left: 2px;
}

/* ── Stats bar ── */
.bpp-stats-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7px 14px;
    border-bottom: 0.5px solid var(--color-border-tertiary);
    background: var(--color-background-secondary);
    font-size: 12px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

    .bpp-stats-bar b {
        color: var(--color-text-primary);
        font-weight: 500;
    }

.bpp-stat-ok {
    color: #3B6D11;
}

.bpp-stat-err {
    color: #A32D2D;
}

.bpp-stat-warn {
    color: #854F0B;
}

/* ── Loading ── */
.bpp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.bpp-loading-inline {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--color-text-secondary);
    padding: 4px 0;
}

/* ── Scroll ── */
.bpp-scroll {
    overflow-y: auto;
}

/* ── Preview grid ── */
.bpp-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    flex: 1;
    grid-auto-rows: max-content;
}

.bpp-pv-card {
    border-radius: var(--border-radius-md);
    border: 0.5px solid var(--color-border-tertiary);
    overflow: hidden;
    background: var(--color-background-secondary);
    cursor: pointer;
    transition: border-color .12s;
}

    .bpp-pv-card:hover {
        border-color: var(--color-border-secondary);
    }

    .bpp-pv-card.excluded {
        opacity: .45;
    }

.bpp-pv-img {
    height: 80px;
    background: var(--color-background-tertiary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

    .bpp-pv-img i {
        font-size: 20px;
        color: var(--color-text-tertiary);
    }

.bpp-order {
    position: absolute;
    top: 3px;
    left: 3px;
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
}

.bpp-incl-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #639922;
}

.bpp-excl-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.3);
}

    .bpp-excl-overlay i {
        font-size: 18px;
        color: #fff;
    }

.bpp-multi-badge {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: #EF9F27;
    color: #412402;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
}

.bpp-pv-info {
    padding: 5px 6px;
}

.bpp-pv-name {
    font-size: 10px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bpp-pv-row {
    display: flex;
    gap: 3px;
    margin-top: 3px;
}

.bpp-pv-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 18px;
    border-radius: 3px;
    border: 0.5px solid var(--color-border-tertiary);
    background: transparent;
    cursor: pointer;
    font-size: 10px;
    color: var(--color-text-secondary);
}

    .bpp-pv-btn:hover {
        background: var(--color-background-primary);
    }

    .bpp-pv-btn.on {
        border-color: #639922;
        background: #EAF3DE;
        color: #27500A;
    }

    .bpp-pv-btn.off {
        border-color: var(--color-border-danger);
        color: var(--color-text-danger);
    }

        .bpp-pv-btn.off:hover {
            background: var(--color-background-danger);
        }


/* ── Reorder list ── */
.bpp-ro-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 14px;
    flex: 1;
}

.bpp-ro-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--border-radius-md);
    border: 0.5px solid var(--color-border-tertiary);
    background: var(--color-background-secondary);
    cursor: grab;
    transition: border-color .1s;
}

    .bpp-ro-item:hover {
        border-color: var(--color-border-secondary);
        background: var(--color-background-primary);
    }

    .bpp-ro-item.excluded-item {
        opacity: .5;
    }

.bpp-grip {
    color: var(--color-text-tertiary);
    font-size: 14px;
    flex-shrink: 0;
}

.bpp-ro-num {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.bpp-ro-thumb {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: var(--color-background-tertiary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

    .bpp-ro-thumb i {
        font-size: 14px;
        color: var(--color-text-tertiary);
    }

.bpp-ro-body {
    flex: 1;
    min-width: 0;
}

.bpp-ro-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bpp-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

.badge-ok {
    background: #EAF3DE;
    color: #27500A;
}

.badge-excl {
    background: var(--color-background-tertiary);
    color: var(--color-text-tertiary);
    border: 0.5px solid var(--color-border-tertiary);
}

.bpp-ro-arrows {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.bpp-ro-arr {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 14px;
    border: 0.5px solid var(--color-border-tertiary);
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    font-size: 9px;
    color: var(--color-text-secondary);
}

    .bpp-ro-arr:hover {
        background: var(--color-background-primary);
    }

    .bpp-ro-arr:disabled {
        opacity: .3;
        cursor: not-allowed;
    }

/* ── Export / check rows ── */
.bpp-section-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 7px;
}

.bpp-check-row {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 7px 10px;
    border-radius: var(--border-radius-md);
    font-size: 12px;
    line-height: 1.45;
}

    .bpp-check-row i {
        font-size: 14px;
        flex-shrink: 0;
        margin-top: 1px;
    }

.bpp-check-ok {
    background: #EAF3DE;
    color: #27500A;
    border: 0.5px solid #C0DD97;
}

.bpp-check-warn {
    background: #FAEEDA;
    color: #633806;
    border: 0.5px solid #FAC775;
}

.bpp-check-error {
    background: #FCEBEB;
    color: #791F1F;
    border: 0.5px solid #F7C1C1;
}

.bpp-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bpp-setting-label {
    font-size: 13px;
    color: var(--color-text-primary);
}

.bpp-select {
    font-size: 12px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--color-border-secondary);
    background: var(--color-background-secondary);
    color: var(--color-text-primary);
}

.bpp-progress-track {
    height: 6px;
    background: var(--color-background-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.bpp-progress-fill {
    height: 100%;
    background: #639922;
    border-radius: 3px;
    transition: width .3s ease;
}

/* ── Post-export ── */
.bpp-success-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius-md);
    background: #EAF3DE;
    border: 0.5px solid #C0DD97;
}

.bpp-action-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
}

.bpp-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: var(--border-radius-md);
    border: 0.5px solid var(--color-border-tertiary);
    background: var(--color-background-secondary);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: border-color .12s;
}

    .bpp-action-card:hover {
        border-color: var(--color-border-secondary);
        background: var(--color-background-primary);
    }

    .bpp-action-card i {
        font-size: 20px;
        color: var(--color-text-secondary);
    }

.bpp-ac-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-primary);
}

.bpp-ac-sub {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.bpp-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--border-radius-md);
    border: 0.5px solid var(--color-border-tertiary);
    background: var(--color-background-secondary);
}

    .bpp-history-item.latest {
        border-color: #C0DD97;
        background: #EAF3DE18;
    }

.bpp-history-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #EAF3DE;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .bpp-history-icon i {
        font-size: 14px;
        color: #3B6D11;
    }

.bpp-history-body {
    flex: 1;
    min-width: 0;
}

.bpp-history-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bpp-history-meta {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-top: 1px;
}

.bpp-new-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 5px;
    background: #EAF3DE;
    color: #27500A;
    font-weight: 500;
}

.bpp-kdp-reminder {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 8px 10px;
    border-radius: var(--border-radius-md);
    background: var(--color-background-secondary);
    border: 0.5px solid var(--color-border-tertiary);
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.45;
}

    .bpp-kdp-reminder b {
        color: var(--color-text-primary);
        font-weight: 500;
    }

/* ── Footer ── */
.bpp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-top: 0.5px solid var(--color-border-tertiary);
    background: var(--color-background-primary);
    flex-shrink: 0;
    gap: 8px;
}

.bpp-footer-info {
    font-size: 12px;
    color: var(--color-text-secondary);
}

    .bpp-footer-info b {
        color: var(--color-text-primary);
        font-weight: 500;
    }

.bpp-footer-btns {
    display: flex;
    gap: 6px;
}

/* ── Buttons ── */
.bpp-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--border-radius-md);
    border: 0.5px solid var(--color-border-secondary);
    background: transparent;
    font-size: 12px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background .12s;
    text-decoration: none;
}

    .bpp-btn:hover:not(:disabled) {
        background: var(--color-background-secondary);
    }

    .bpp-btn:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

    .bpp-btn i {
        font-size: 13px;
    }

.bpp-btn-sm {
    padding: 4px 9px;
    font-size: 11px;
}

    .bpp-btn-sm i {
        font-size: 12px;
    }

.bpp-btn-primary {
    background: #639922;
    border-color: #3B6D11;
    color: #EAF3DE;
}

    .bpp-btn-primary:hover:not(:disabled) {
        opacity: .88;
        background: #639922;
    }

.bpp-btn-danger {
    border-color: var(--color-border-danger);
    color: var(--color-text-danger);
}

    .bpp-btn-danger:hover:not(:disabled) {
        background: var(--color-background-danger);
    }

/* ── Dark mode ── */
html[data-theme="dark"] .bpp-drawer,
.adm-dark .bpp-drawer {
    background: var(--color-background-primary);
    border-color: var(--color-border-secondary);
}

html[data-theme="dark"] .bpp-select,
.adm-dark .bpp-select {
    border-color: #4b5563;
    background: #111827;
    color: #f9fafb;
}

html[data-theme="dark"] .bpp-pv-btn.on,
.adm-dark .bpp-pv-btn.on {
    background: rgba(99,153,34,.15);
    color: var(--color-text-secondary)
}

html[data-theme="dark"] .bpp-history-item.latest,
.adm-dark .bpp-history-item.latest {
    background: rgba(99,153,34,.08);
}

html[data-theme="dark"] .bpp-action-card:hover,
.adm-dark .bpp-action-card:hover {
    background: var(--color-background-secondary);
}

/* ── Mobile ── */
@media (max-width: 767px) {
    .bpp-drawer {
        width: 100%;
    }

    .bpp-preview-grid {
        grid-template-columns: repeat(3,1fr);
    }

    .bpp-action-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   AIREQ BUTTON FIX — approve / reject / model selector
   Thêm base styles bị thiếu + fix light mode
   ============================================================ */

/* ── Base .aireq-btn (bị thiếu hoàn toàn) ── */
.aireq-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 7px;
    border: none;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, opacity .12s;
    white-space: nowrap;
}

    .aireq-btn:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

    /* full width variant (bottom panel) */
    .aireq-btn.full {
        flex: 1;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 8px;
    }

    /* ── Approve — light mode ── */
    .aireq-btn.approve {
        background: #f0fdf4;
        color: #166534;
        border: 1px solid #bbf7d0;
    }

        .aireq-btn.approve:hover:not(:disabled) {
            background: #dcfce7;
            border-color: #86efac;
        }

        .aireq-btn.approve.full {
            background: #16a34a;
            color: #fff;
            border-color: #15803d;
        }

            .aireq-btn.approve.full:hover:not(:disabled) {
                background: #15803d;
            }

    /* ── Reject — light mode ── */
    .aireq-btn.reject {
        background: #fef2f2;
        color: #991b1b;
        border: 1px solid #fecaca;
    }

        .aireq-btn.reject:hover:not(:disabled) {
            background: #fee2e2;
            border-color: #fca5a5;
        }

        .aireq-btn.reject.full {
            background: transparent;
            color: #dc2626;
            border: 1px solid #fca5a5;
        }

            .aireq-btn.reject.full:hover:not(:disabled) {
                background: #fef2f2;
            }

/* ── Quick action buttons (icon-only, cạnh page item) ── */
.aireq-quick-actions .aireq-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 6px;
}

/* aireq-model-row: defined above in base styles */

/* ── Dark mode overrides ── */
html[data-theme="dark"] .aireq-btn.approve,
.adm-dark .aireq-btn.approve {
    background: #052e16;
    color: #86efac;
    border-color: #166534;
}

    html[data-theme="dark"] .aireq-btn.approve:hover:not(:disabled),
    .adm-dark .aireq-btn.approve:hover:not(:disabled) {
        background: #14532d;
    }

    html[data-theme="dark"] .aireq-btn.approve.full,
    .adm-dark .aireq-btn.approve.full {
        background: #166534;
        color: #bbf7d0;
        border-color: #15803d;
    }

        html[data-theme="dark"] .aireq-btn.approve.full:hover:not(:disabled),
        .adm-dark .aireq-btn.approve.full:hover:not(:disabled) {
            background: #14532d;
        }

html[data-theme="dark"] .aireq-btn.reject,
.adm-dark .aireq-btn.reject {
    background: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}

    html[data-theme="dark"] .aireq-btn.reject:hover:not(:disabled),
    .adm-dark .aireq-btn.reject:hover:not(:disabled) {
        background: #7f1d1d;
    }

    html[data-theme="dark"] .aireq-btn.reject.full,
    .adm-dark .aireq-btn.reject.full {
        background: transparent;
        color: #fca5a5;
        border-color: #7f1d1d;
    }

        html[data-theme="dark"] .aireq-btn.reject.full:hover:not(:disabled),
        .adm-dark .aireq-btn.reject.full:hover:not(:disabled) {
            background: #450a0a;
        }

html[data-theme="dark"] .aireq-model-row,
.adm-dark .aireq-model-row {
    background: var(--color-background-secondary, #111827);
    border-color: var(--color-border-primary, #374151) !important;
}

    html[data-theme="dark"] .aireq-model-row.selected,
    .adm-dark .aireq-model-row.selected {
        border-color: #6366f1 !important;
        background: #1e1b4b;
    }
