/* ============================================================================
   DEBUG / BUG REPORTING UI
   Dark theme styling using global CSS variables from global-theme.css
   ============================================================================ */

/* ---- Bug toggle icon on each component ---- */
.debug-toggle-icon {
    position: absolute;
    top: 12px;
    right: 40px; /* sits to the left of the .chart-info-icon (right:12px + 22px + 6px gap) */
    width: 22px;
    height: 22px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.15s ease;
    z-index: 50;
    fill: var(--dark-text-secondary, #bfc8d1);
    pointer-events: none;
}

/* Fade in when the parent container is hovered */
.chart-container:hover > .debug-toggle-icon,
.summary-cards:hover > .debug-toggle-icon,
.table-container:hover > .debug-toggle-icon,
[data-debug-id]:hover > .debug-toggle-icon {
    opacity: 0.4;
    pointer-events: auto;
}

.debug-toggle-icon:hover {
    opacity: 0.85 !important;
    transform: scale(1.15);
    pointer-events: auto;
}

/* Always visible when selected */
.debug-toggle-icon.selected {
    opacity: 1 !important;
    fill: var(--dark-accent, #D4A574);
    filter: drop-shadow(0 0 4px rgba(212, 165, 116, 0.5));
    pointer-events: auto;
}

/* Chatbot header debug button — inline with other header action buttons */
.chatbot-header-btn.chatbot-debug-btn {
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}

.chatbot-header-btn.chatbot-debug-btn svg {
    width: 18px;
    height: 18px;
    fill: var(--chat-white, #fff);
}

.chatbot-header-btn.chatbot-debug-btn:hover {
    opacity: 1;
}

.chatbot-header-btn.chatbot-debug-btn.selected {
    opacity: 1;
    background: rgba(255, 255, 255, 0.35);
}

.chatbot-header-btn.chatbot-debug-btn.selected svg {
    fill: #fff;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

/* Section-level inline icon (next to h2) */
.debug-section-icon {
    display: inline-block;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    fill: var(--dark-text-secondary, #bfc8d1);
    pointer-events: none;
}

/* Fade in when hovering the heading */
h2:hover > .debug-section-icon {
    opacity: 0.4;
    pointer-events: auto;
}

.debug-section-icon:hover {
    opacity: 0.85 !important;
    pointer-events: auto;
}

/* Always visible when selected */
.debug-section-icon.selected {
    opacity: 1 !important;
    fill: var(--dark-accent, #D4A574);
    pointer-events: auto;
}

/* Gold border glow on selected containers */
.debug-selected {
    outline: 2px solid var(--dark-accent, #D4A574) !important;
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.25) !important;
    transition: outline-color 0.4s ease, box-shadow 0.4s ease;
}

/* Fade-out when removing — class removed after transition */
.debug-selected.debug-deselecting {
    outline-color: transparent !important;
    box-shadow: 0 0 0 rgba(212, 165, 116, 0) !important;
}

/* Section-title heading highlight */
h2.section-title.debug-section-selected {
    outline: 2px solid var(--dark-accent, #D4A574) !important;
    outline-offset: 4px;
    border-radius: 4px;
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.25) !important;
    transition: outline-color 0.4s ease, box-shadow 0.4s ease;
}

h2.section-title.debug-section-selected.debug-deselecting {
    outline-color: transparent !important;
    box-shadow: 0 0 0 rgba(212, 165, 116, 0) !important;
}

/* Children included via section-title selection */
.debug-selected-child {
    outline: 2px solid var(--dark-accent, #D4A574) !important;
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.25) !important;
    transition: outline-color 0.4s ease, box-shadow 0.4s ease;
}

.debug-selected-child.debug-deselecting {
    outline-color: transparent !important;
    box-shadow: 0 0 0 rgba(212, 165, 116, 0) !important;
}

/* Pulse on initial selection — applied to h2 and children */
@keyframes debug-border-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.6); }
    40%  { box-shadow: 0 0 20px 4px rgba(212, 165, 116, 0.35); }
    100% { box-shadow: 0 0 12px 0 rgba(212, 165, 116, 0.25); }
}

.debug-section-pulse {
    animation: debug-border-pulse 0.8s ease-out 1 !important;
}

/* ---- Master icon (fixed top-right) ---- */
#debug-master-icon {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--dark-bg-tertiary, #252d3d);
    border: 1px solid var(--dark-border, #2f3944);
    cursor: pointer;
    display: flex; /* always visible for page-level reporting */
    align-items: center;
    justify-content: center;
    z-index: 10005;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#debug-master-icon:hover {
    background: var(--dark-accent, #D4A574) !important;
    transform: scale(1.05);
}

#debug-master-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--dark-accent, #D4A574);
}

#debug-master-icon:hover svg {
    fill: #fff !important;
}

@media (max-width: 768px) {
    #debug-master-icon {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }
}

#debug-master-icon .debug-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--dark-danger, #E74C3C);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Pulse animation on first select */
@keyframes debug-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(212, 165, 116, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0); }
}

#debug-master-icon.pulse {
    animation: debug-pulse 1s ease-out 2;
}

/* ---- Modal overlay ---- */
.debug-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 10010;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 12px 0;
}

.debug-modal-overlay.visible {
    display: flex;
}

/* ---- Modal card ---- */
.debug-modal {
    width: 90%;
    max-width: 700px;
    max-height: 95vh;
    margin: 12px auto;
    background: var(--dark-bg-secondary, #1a1f2e);
    border: 1px solid var(--dark-border, #2f3944);
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 768px) {
    .debug-modal {
        width: 96%;
        max-height: 98vh;
    }
    .debug-modal-footer {
        flex-wrap: wrap;
    }
}

@media (max-height: 600px) {
    .debug-modal {
        max-height: 100vh;
        margin: 0 auto;
        border-radius: 0;
    }
    .debug-modal-overlay {
        padding: 0;
    }
}

.debug-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--dark-border, #2f3944);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.debug-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--dark-text-primary, #e7e9ea);
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-modal-header h2 svg {
    width: 20px;
    height: 20px;
    fill: var(--dark-accent, #D4A574);
}

.debug-modal-close {
    background: none;
    border: none;
    color: var(--dark-text-secondary, #8b98a5);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s;
}

.debug-modal-close:hover {
    background: var(--dark-bg-tertiary, #252d3d) !important;
    color: var(--dark-text-primary, #e7e9ea) !important;
}

.debug-modal-body {
    flex: 1;
    min-height: 0;  /* Allow flex child to shrink below content size for proper scrolling */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Form row (side-by-side groups) */
.debug-form-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.debug-form-group-grow {
    flex: 1;
    min-width: 0;
}

.debug-form-group-priority {
    flex: 0 0 auto;
    min-width: 120px;
}

/* Form elements */
.debug-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.debug-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-text-secondary, #8b98a5);
}

.debug-form-group textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-tertiary, #252d3d);
    color: var(--dark-text-primary, #e7e9ea);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
}

.debug-form-group textarea:focus {
    outline: none;
    border-color: var(--dark-accent, #D4A574);
}

.debug-form-group textarea::placeholder {
    color: var(--dark-text-muted, #6e767d);
}

/* Report type selector */
.debug-report-type-row {
    display: flex;
    gap: 16px;
    padding: 4px 0;
}

.debug-report-type-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--dark-text-primary, #e7e9ea);
}

.debug-report-type-option input[type="radio"] {
    accent-color: var(--dark-accent, #D4A574);
}

/* Section checklist */
.debug-section-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.debug-section-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: var(--dark-bg-tertiary, #252d3d);
    border-radius: 8px;
    border: 1px solid var(--dark-border, #2f3944);
}

.debug-section-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-section-item-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--dark-accent, #D4A574);
}

.debug-section-item-header .section-name {
    flex: 1;
    font-size: 13px;
    color: var(--dark-text-primary, #e7e9ea);
}

.debug-section-item-header .section-type {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(212, 165, 116, 0.15);
    color: var(--dark-accent, #D4A574);
}

.debug-section-item-header .toggle-notes {
    font-size: 11px;
    color: var(--dark-text-muted, #6e767d);
    cursor: pointer;
    background: none;
    border: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.debug-section-item-header .toggle-notes:hover {
    color: var(--dark-accent, #D4A574) !important;
    background: transparent !important;
}

.debug-section-notes {
    display: none;
}

.debug-section-notes.visible {
    display: block;
}

.debug-section-notes textarea {
    width: 100%;
    min-height: 40px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-card, #1e2533);
    color: var(--dark-text-primary, #e7e9ea);
    font-family: inherit;
    font-size: 12px;
    resize: vertical;
    box-sizing: border-box;
}

.debug-section-notes textarea:focus {
    outline: none;
    border-color: var(--dark-accent, #D4A574);
}

/* Checkboxes row */
.debug-options-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.debug-options-split {
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--dark-border, #2f3944);
    padding-top: 16px;
    margin-top: 8px;
}

.debug-options-left, .debug-options-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

.debug-form-group-priority-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.debug-priority-select-inline {
    padding: 2px 8px;
    width: auto;
}

.debug-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--dark-text-secondary, #8b98a5);
    cursor: pointer;
}

.debug-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--dark-accent, #D4A574);
}

.debug-option-label {
    font-size: 13px;
    color: var(--dark-text-secondary, #8b98a5);
}

.debug-select, .debug-priority-select {
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-tertiary, #252d3d) !important;
    color: var(--dark-text-primary, #e7e9ea) !important;
    font-size: 13px;
    cursor: pointer;
}

.debug-select:focus, .debug-priority-select:focus {
    outline: none;
    border-color: var(--dark-accent, #D4A574);
}

.debug-modal input::selection, 
.debug-modal textarea::selection {
    background: rgba(212, 165, 116, 0.4);
    color: #fff;
}

/* Priority selector specifics */
.debug-priority-select {
    width: 100%;
    padding: 8px 10px;
}

.debug-priority-select option[value="low"] { color: var(--dark-text-secondary, #8b98a5); }
.debug-priority-select option[value="medium"] { color: var(--dark-accent, #D4A574); }
.debug-priority-select option[value="high"] { color: var(--dark-warning, #F39C12); }
.debug-priority-select option[value="critical"] { color: var(--dark-danger, #E74C3C); }

/* Data preview */
.debug-preview {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: var(--dark-bg-tertiary, #252d3d);
    border-radius: 8px;
    font-size: 12px;
    color: var(--dark-text-muted, #6e767d);
}

.debug-preview-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.debug-preview-stat strong {
    color: var(--dark-text-primary, #e7e9ea);
}

/* Footer buttons */
.debug-modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--dark-border, #2f3944);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.debug-footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.debug-footer-right {
    display: flex;
    gap: 10px;
}

.debug-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid var(--dark-border, #2f3944);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.debug-btn-cancel {
    background: var(--dark-bg-tertiary, #252d3d);
    color: var(--dark-text-secondary, #8b98a5);
}

.debug-btn-cancel:hover {
    background: var(--dark-bg-card, #1e2533) !important;
    color: var(--dark-text-primary, #e7e9ea) !important;
}

.debug-btn-save {
    background: var(--dark-accent, #D4A574);
    color: #fff;
    border-color: var(--dark-accent, #D4A574);
}

.debug-btn-save:hover {
    opacity: 0.9;
    background: var(--dark-accent, #D4A574) !important;
    color: #fff !important;
    border-color: var(--dark-accent, #D4A574) !important;
}

.debug-btn-launch {
    background: var(--dark-success, #2ECC71);
    color: #fff;
    border-color: var(--dark-success, #2ECC71);
}

.debug-btn-launch:hover {
    opacity: 0.9;
    background: var(--dark-success, #2ECC71) !important;
    color: #fff !important;
    border-color: var(--dark-success, #2ECC71) !important;
}

/* Success notification */
.debug-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 10px;
    background: var(--dark-bg-card, #1e2533);
    border: 1px solid var(--dark-success, #2ECC71);
    color: var(--dark-text-primary, #e7e9ea);
    font-size: 13px;
    z-index: 10020;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: debug-slide-in 0.3s ease-out;
}

@keyframes debug-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.debug-notification .debug-notif-title {
    font-weight: 700;
    color: var(--dark-success, #2ECC71);
    margin-bottom: 4px;
}

.debug-notification .debug-notif-detail {
    color: var(--dark-text-secondary, #8b98a5);
    font-size: 12px;
}

/* ---- Inline Section Previews (chat) ---- */
.chat-debug-preview {
    margin: 12px 0;
    animation: debugFadeIn 0.3s ease;
}

.chat-debug-preview .preview-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-text-secondary, #8b98a5);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-debug-preview .preview-cards-wrapper {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}

.chat-debug-preview .preview-cards-wrapper::-webkit-scrollbar {
    height: 4px;
}

.chat-debug-preview .preview-cards-wrapper::-webkit-scrollbar-thumb {
    background: var(--dark-border, #2f3944);
    border-radius: 2px;
}

.chat-debug-preview .preview-card {
    flex: 0 0 220px;
    width: 220px;
    background: var(--dark-bg-tertiary, #252d3d);
    border: 1px solid var(--dark-border, #2f3944);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: debugFadeIn 0.3s ease;
}

.chat-debug-preview .preview-card:hover {
    border-color: var(--dark-accent, #D4A574);
    box-shadow: 0 2px 10px rgba(212, 165, 116, 0.15);
}

.chat-debug-preview .preview-card.selected {
    border-color: var(--dark-accent, #D4A574);
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.25);
}

.chat-debug-preview .preview-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid var(--dark-border, #2f3944);
}

.chat-debug-preview .preview-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-text-primary, #e7e9ea);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.chat-debug-preview .preview-card-type {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(212, 165, 116, 0.15);
    color: var(--dark-accent, #D4A574);
    flex-shrink: 0;
    margin-left: 6px;
}

.chat-debug-preview .preview-card-viewport {
    width: 220px;
    height: 150px;
    overflow: hidden;
    position: relative;
    background: var(--dark-bg-card, #1e2533);
}

.chat-debug-preview .preview-card-viewport .scaled-clone {
    transform: scale(0.35);
    transform-origin: top left;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
}

.chat-debug-preview .preview-card-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 12px;
    color: var(--dark-text-muted, #6e767d);
    font-style: italic;
}

/* ---- Inline Selectable Checklist (chat) ---- */
.chat-debug-checklist {
    margin: 12px 0;
    background: var(--dark-bg-tertiary, #252d3d);
    border: 1px solid var(--dark-border, #2f3944);
    border-radius: 10px;
    overflow: hidden;
    animation: debugFadeIn 0.3s ease;
}

.chat-debug-checklist .checklist-header {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-text-primary, #e7e9ea);
    border-bottom: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-card, #1e2533);
}

.chat-debug-checklist .checklist-items {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

.chat-debug-checklist .checklist-items::-webkit-scrollbar {
    width: 4px;
}

.chat-debug-checklist .checklist-items::-webkit-scrollbar-thumb {
    background: var(--dark-border, #2f3944);
    border-radius: 2px;
}

.chat-debug-checklist .checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background 0.15s;
    cursor: pointer;
}

.chat-debug-checklist .checklist-item:hover {
    background: rgba(212, 165, 116, 0.06);
}

.chat-debug-checklist .checklist-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--dark-accent, #D4A574);
    margin-top: 2px;
    flex-shrink: 0;
}

.chat-debug-checklist .checklist-item-content {
    flex: 1;
    min-width: 0;
}

.chat-debug-checklist .checklist-item-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark-text-primary, #e7e9ea);
}

.chat-debug-checklist .checklist-item-desc {
    font-size: 11px;
    color: var(--dark-text-muted, #6e767d);
    margin-top: 2px;
}

.chat-debug-checklist .checklist-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-card, #1e2533);
}

.chat-debug-checklist .checklist-actions button {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    border: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-tertiary, #252d3d);
    color: var(--dark-text-primary, #e7e9ea);
}

.chat-debug-checklist .checklist-actions button:hover {
    opacity: 0.85;
}

.chat-debug-checklist .checklist-actions .checklist-submit-btn {
    background: var(--dark-accent, #D4A574);
    color: #fff;
    border-color: var(--dark-accent, #D4A574);
}

.chat-debug-checklist.submitted {
    opacity: 0.55;
    pointer-events: none;
    position: relative;
}

.chat-debug-checklist.submitted::after {
    content: 'Submitted';
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--dark-success, #2ECC71);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Screenshot Gallery (report form) ---- */
.debug-screenshot-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
}

.debug-screenshot-gallery::-webkit-scrollbar {
    width: 4px;
}

.debug-screenshot-gallery::-webkit-scrollbar-thumb {
    background: var(--dark-border, #2f3944);
    border-radius: 2px;
}

.debug-screenshot-thumb {
    width: 120px;
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-tertiary, #252d3d);
    overflow: hidden;
    transition: border-color 0.2s;
}

.debug-screenshot-thumb:hover {
    border-color: var(--dark-accent, #D4A574);
}

.debug-screenshot-thumb img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.debug-screenshot-label {
    font-size: 10px;
    color: var(--dark-text-secondary, #8b98a5);
    padding: 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.debug-screenshot-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.85);
    color: #fff;
    border: none;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
}

.debug-screenshot-thumb:hover .debug-screenshot-remove {
    opacity: 1;
}

.debug-screenshot-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.debug-btn-capture {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border: 1px solid var(--dark-accent, #D4A574);
    border-radius: 6px;
    background: transparent;
    color: var(--dark-accent, #D4A574);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.debug-btn-capture:hover {
    background: var(--dark-accent, #D4A574);
    color: #fff;
}

.debug-btn-capture:disabled {
    opacity: 0.5;
    cursor: default;
}

.debug-btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px dashed var(--dark-border, #2f3944);
    border-radius: 6px;
    background: transparent;
    color: var(--dark-text-secondary, #8b98a5);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.debug-btn-upload:hover {
    border-color: var(--dark-accent, #D4A574);
    color: var(--dark-accent, #D4A574);
}

.debug-screenshot-empty {
    font-size: 12px;
    color: var(--dark-text-muted, #6e767d);
    padding: 8px;
    font-style: italic;
}

/* ---- Screenshot Lightbox ---- */
.debug-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10030;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: debugFadeIn 0.2s ease;
}

.debug-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    padding: 16px;
}

.debug-lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.debug-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--dark-bg-secondary, #1a1f2e);
    border: 1px solid var(--dark-border, #2f3944);
    color: var(--dark-text-primary, #e7e9ea);
    font-size: 20px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    z-index: 1;
    padding: 0;
}

.debug-lightbox-close:hover {
    background: var(--dark-danger, #E74C3C) !important;
    color: #fff !important;
}

.debug-lightbox-label {
    text-align: center;
    margin-top: 8px;
    font-size: 13px;
    color: var(--dark-text-secondary, #8b98a5);
}

@keyframes debugFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Section Chips (compact display) ---- */
.debug-section-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
}

.debug-section-empty {
    color: var(--dark-text-muted, #6e767d);
    font-size: 12px;
    padding: 8px;
}

.debug-section-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 6px;
    border-radius: 6px;
    background: var(--dark-bg-tertiary, #252d3d);
    border: 1px solid var(--dark-border, #2f3944);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 12px;
}

.debug-section-chip:hover {
    border-color: var(--dark-accent, #D4A574);
}

.debug-section-chip.active {
    border-color: var(--dark-accent, #D4A574);
    background: rgba(212, 165, 116, 0.1);
}

.debug-section-chip.has-notes {
    border-color: var(--dark-accent, #D4A574);
}

.debug-section-chip.has-notes::after {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--dark-accent, #D4A574);
    flex-shrink: 0;
}

.debug-section-chip-type {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(212, 165, 116, 0.15);
    color: var(--dark-accent, #D4A574);
    flex-shrink: 0;
    text-transform: lowercase;
}

.debug-section-chip-name {
    color: var(--dark-text-primary, #e7e9ea);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.debug-section-chip-remove {
    background: none;
    border: none;
    color: var(--dark-text-muted, #6e767d);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.debug-section-chip-remove:hover {
    color: var(--dark-danger, #E74C3C);
}

/* ---- Section Notes Area (below chips) ---- */
.debug-section-notes-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.debug-section-notes-block {
    display: none;
    border-radius: 8px;
    border: 1px solid var(--dark-border, #2f3944);
    background: var(--dark-bg-tertiary, #252d3d);
    overflow: hidden;
    animation: debugFadeIn 0.15s ease;
}

.debug-section-notes-block.visible {
    display: block;
}

.debug-section-notes-header {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--dark-text-secondary, #8b98a5);
    border-bottom: 1px solid var(--dark-border, #2f3944);
}

.debug-section-notes-block textarea {
    width: 100%;
    min-height: 50px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--dark-text-primary, #e7e9ea);
    font-family: inherit;
    font-size: 12px;
    resize: vertical;
    box-sizing: border-box;
}

.debug-section-notes-block textarea:focus {
    outline: none;
}
