/* Velvet Study Stylesheet */
:root {
    --bg-dark: #0f0f13;
    --card-bg: #181820;
    --card-hover: #20202b;
    --border-color: #272733;
    --border-light: #38384a;
    --text-main: #f4f4f5;
    --text-muted: #9ca3af;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent-gold: #fbbf24;
    --accent-blue: #38bdf8;
    --success: #10b981;
    --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header & Nav */
header {
    background: #14141a;
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    z-index: 10;
}
.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.brand-dragon {
    color: var(--primary);
    font-size: 1.3rem;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tabs Bar */
.tabs-bar {
    background: #121217;
    border-bottom: 1px solid var(--border-color);
    padding: 0.3rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
}
.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s;
    white-space: nowrap;
}
.tab-btn:hover {
    background: var(--card-bg);
    color: var(--text-main);
}
.tab-btn.active {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: #fff;
    font-weight: 600;
}
.btn-new-candidate {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px dashed var(--primary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
}
.btn-new-candidate:hover {
    background: var(--primary);
    color: #fff;
}

/* Main Workspace */
.workspace-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 340px;
    overflow: hidden;
}

/* Chat Section */
.chat-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.customer-header-bar {
    background: #14141b;
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.customer-title-info {
    display: flex;
    flex-direction: column;
}
.customer-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}
.customer-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.meters-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.meter-item {
    display: flex;
    flex-direction: column;
    width: 140px;
}
.meter-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
    font-weight: 600;
}
.meter-bar-track {
    height: 8px;
    background: #272733;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.meter-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.override-trigger {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 0.3rem;
}
.override-trigger:hover { color: #fff; }

/* Messages Scroll Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.message-wrapper.role-player {
    align-self: flex-end;
}
.message-wrapper.role-assistant {
    align-self: flex-start;
}

.chat-bubble {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    position: relative;
}
.chat-bubble.role-player {
    background: #1e1b2e;
    border-color: #3b2d54;
    color: #f3f4f6;
}
.message-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.msg-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: all 0.15s;
}
.msg-btn:hover {
    background: #272733;
    color: #fff;
}
.variant-nav {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    background: #14141c;
    border: 1px solid var(--border-color);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Chat Input Bar */
.chat-input-bar {
    background: #14141b;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.chat-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}
.chat-textarea {
    flex: 1;
    background: #0f0f13;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    padding: 0.7rem 0.9rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    outline: none;
    line-height: 1.4;
}
.chat-textarea:focus {
    border-color: var(--primary);
}
.btn-send {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    height: 44px;
}
.btn-send:hover { background: var(--primary-hover); }
.btn-send:disabled {
    background: #272733;
    color: #6b7280;
    cursor: not-allowed;
}
.typing-indicator {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    min-height: 18px;
}

.quick-actions-bar {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}
.quick-action-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    color: var(--accent-blue);
    cursor: pointer;
    transition: all 0.15s ease;
}
.quick-action-pill:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent-blue);
    color: #fff;
}

.debug-telemetry-line {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 0.4rem;
    padding: 0.2rem 0.5rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.debug-view-btn {
    background: none;
    border: none;
    color: var(--accent-blue);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 0;
}
.debug-view-btn:hover {
    color: #fff;
}
.debug-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}
.debug-tab-btn.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
    font-weight: 600;
}

/* Inline Settlement Card in Chat */
.inline-settlement-card {
    background: linear-gradient(145deg, #181822 0%, #121217 100%);
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.3s ease-in-out;
}
.settlement-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.settlement-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.settlement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}
.settlement-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.settlement-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}
.settlement-input {
    background: #09090c;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: #fff;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    outline: none;
}
.settlement-input:focus {
    border-color: var(--accent-gold);
}
.settlement-btn {
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.settlement-btn:hover {
    background: #10b981;
}
.settlement-btn:disabled {
    background: #272733;
    color: #6b7280;
    cursor: not-allowed;
}

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

/* Inline Persona Draft Card */
.inline-draft-card {
    background: linear-gradient(145deg, #181824 0%, #101016 100%);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 1.1rem;
    margin: 1rem 0;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    animation: fadeIn 0.25s ease-in-out;
}
.draft-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}
.draft-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}
.draft-body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #0b0b0f;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #f4f4f5;
    outline: none;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}
.draft-body:focus {
    border-color: var(--primary);
}
.draft-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Side Panels */
.side-panel-section {
    background: #14141a;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.side-nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #111116;
}
.side-tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.side-tab-btn.active {
    color: #fff;
    border-bottom-color: var(--primary);
    background: var(--card-bg);
}
.side-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: none;
}
.side-tab-content.active {
    display: block;
}

/* Hard Facts Display */
.facts-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.fact-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
}
.fact-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    font-weight: 600;
}
.fact-value {
    font-size: 0.9rem;
    color: #fff;
    word-break: break-word;
}

/* Soft Info Display */
.soft-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.soft-note-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
.soft-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}
.tag-observed { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); border: 1px solid rgba(56, 189, 248, 0.3); }
.tag-deduced { background: rgba(251, 191, 36, 0.15); color: var(--accent-gold); border: 1px solid rgba(251, 191, 36, 0.3); }
.tag-known { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.tag-known-locked { background: rgba(107, 114, 128, 0.2); color: #9ca3af; border: 1px dashed #4b5563; }

/* Telemetry Footer in Side Panel */
.telemetry-footer {
    border-top: 1px solid var(--border-color);
    background: #111116;
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}
.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 100%;
    max-width: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.modal-card-settings {
    max-width: 1100px !important;
    width: 95vw !important;
    max-height: 92vh !important;
    height: 92vh !important;
}
.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-title { font-size: 1.15rem; font-weight: 700; color: #fff; }
.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}
.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: #14141c;
}

/* Candidate Preview Cards */
.candidate-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.candidate-grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    height: 100%;
}
.candidate-card {
    background: #111117;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
    overflow: hidden;
    transition: border-color 0.15s;
}
.candidate-card:hover {
    border-color: var(--primary);
}
.candidate-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.candidate-species-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}
.candidate-question {
    font-style: italic;
    color: #d4d4d8;
    font-size: 0.78rem;
    margin-top: 0.15rem;
    line-height: 1.25;
    /* Show the full surface question: no line-clamp so it is never cut off. */
    display: block;
    overflow: visible;
}

/* Standard Buttons & Inputs */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
    background: #272733;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}
.btn-secondary:hover { background: #323242; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.form-input, .form-select, .form-textarea {
    background: #111117;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #fff;
    padding: 0.55rem 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
}

/* Thought Details */
.message-thought {
    margin-bottom: 0.6rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
}
.thought-summary {
    cursor: pointer;
    color: #94a3b8;
    font-weight: 500;
    user-select: none;
    outline: none;
}
.thought-summary:hover {
    color: #cbd5e1;
}
.thought-content {
    margin-top: 0.5rem;
    color: #cbd5e1;
    font-style: italic;
    white-space: pre-wrap;
    line-height: 1.45;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 0.4rem;
}

/* 5x5 Quick Actions Grid */
.quick-actions-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: #121218;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.5rem;
}
.qa-collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    background: #181824;
    transition: background 0.15s ease;
}
.qa-collapsible-header:hover {
    background: #222234;
}
.qa-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-gold);
}
.qa-header-indicator {
    font-size: 0.72rem;
    transition: transform 0.2s ease;
    display: inline-block;
}
.qa-header-indicator.expanded {
    transform: rotate(90deg);
}
.qa-header-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.qa-collapsible-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.qa-collapsible-body.collapsed {
    display: none;
}
.quick-actions-grid {
    display: grid;
    /* one column per received group; the JS sets --qa-cols (5 for the default 5x5 set) */
    grid-template-columns: repeat(var(--qa-cols, 5), minmax(0, 1fr));
    gap: 0.5rem;
}
@media (max-width: 900px) {
    .quick-actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}
.qa-group {
    background: #181822;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.qa-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-gold);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.25rem;
}
.qa-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.qa-option-btn {
    background: #20202d;
    border: 1px solid transparent;
    color: var(--text-main);
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}
.qa-option-btn:hover {
    background: #2b2b3d;
    border-color: rgba(255, 255, 255, 0.15);
}
.qa-option-btn.selected {
    background: rgba(99, 102, 241, 0.25);
    border-color: #818cf8;
    color: #e0e7ff;
    font-weight: 600;
}
.qa-confirm-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.25rem 0 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.qa-selection-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Ledger Dossier Styling */
.ledger-card {
    background: #14141c;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.ledger-card:hover {
    background: #1c1c27;
    border-color: rgba(255, 255, 255, 0.2);
}
.ledger-card.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

/* Local ComfyUI Generated Portraits & Mood Avatars */
.message-wrapper.role-assistant {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 95%;
}

.chat-mood-avatar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 280px;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.chat-mood-img-wrapper {
    width: 280px;
    height: 280px;
    border-radius: 8px;
    background: #111116;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.chat-mood-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 7px;
}

.clickable-portrait {
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.clickable-portrait:hover {
    transform: scale(1.025);
    filter: brightness(1.08);
}

.chat-mood-spinner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: rgba(18, 18, 24, 0.88);
    padding: 0.5rem;
    box-sizing: border-box;
}

.spinner-circle {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spinCircle 0.9s linear infinite;
}

.image-status-pill {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.chat-mood-spinner[data-status="generating"] .image-status-pill,
.candidate-portrait-loading[data-status="generating"] .image-status-pill {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
}

.image-timer-text, .candidate-image-timer {
    font-size: 0.72rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: var(--text-muted);
}

.image-retry-badge, .candidate-image-retries, .status-retry-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-step-pill {
    font-weight: 600;
    color: var(--accent-gold);
}

.status-tokens-text {
    color: var(--text-color);
}

.status-timer-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: var(--text-muted);
}

.candidate-rolling-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 2.5rem 1rem;
    width: 100%;
}

.candidate-status-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

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

.chat-mood-failed {
    color: #f87171;
    font-size: 2.2rem;
    cursor: help;
}

.chat-mood-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 0.25rem;
    gap: 0.2rem;
}

.chat-mood-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.btn-regen-mood {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 3px;
    width: 18px;
    height: 18px;
    font-size: 0.72rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.btn-regen-mood:hover {
    color: #fff;
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.15);
}

.image-telemetry-line {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    padding: 0.25rem 0.35rem;
    margin-top: 0.25rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    line-height: 1.25;
}

.image-telemetry-line span {
    word-break: break-word;
}

.chat-message-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

/* Candidate Card Layout with Portrait Preview */
.candidate-card-layout {
    display: flex;
    flex-direction: row;
    gap: 0.65rem;
    align-items: stretch;
    height: 100%;
    min-height: 0;
}

.candidate-portrait-wrapper {
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    background: #0d0d12;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.candidate-portrait-wrapper:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

.candidate-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.candidate-portrait-img:hover {
    transform: scale(1.03);
    filter: brightness(1.08);
}

.candidate-placeholder-slot {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.12);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.candidate-placeholder-slot.slot-active {
    border-style: solid;
    border-color: var(--accent-gold);
    background: rgba(217, 119, 6, 0.05);
    box-shadow: 0 0 12px rgba(217, 119, 6, 0.2);
}

.candidate-portrait-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    height: 100%;
    padding: 0.35rem;
    box-sizing: border-box;
    text-align: center;
}

.candidate-info-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.candidate-feral-badge {
    display: inline-block;
    padding: 0.12rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 3px;
    background: #4338ca;
    color: #e0e7ff;
    letter-spacing: 0.04em;
}

/* Mood Progress Badge */
.mood-progress-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #c4b5fd;
    white-space: nowrap;
}
.mood-progress-badge.all-ready {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

/* Ledger Selection List & Dossier Styles */
.ledger-case-card {
    background: #13131a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: all 0.15s ease;
    cursor: pointer;
}
.ledger-case-card:hover {
    border-color: var(--primary);
    background: #181822;
}

.ledger-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}
.ledger-gallery-item {
    background: #0d0d12;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: column;
}
.ledger-gallery-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
}
.ledger-gallery-thumb {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
}
.ledger-gallery-caption {
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-align: center;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #111116;
}

.dossier-box {
    background: #111117;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.85rem 1rem;
}
.dossier-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}
.dossier-text-view {
    font-size: 0.88rem;
    line-height: 1.5;
    color: #e4e4e7;
    white-space: pre-wrap;
}

/* Architect Assistant Styles */
.assistant-chip {
    background: #181822;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.25rem 0.65rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.assistant-chip:hover {
    background: #232332;
    color: #fff;
    border-color: var(--primary);
}

.asst-msg-row {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}
.asst-msg-user {
    justify-content: flex-end;
}
.asst-msg-bot {
    justify-content: flex-start;
}

.asst-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.asst-bubble {
    max-width: 88%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.55;
}
.asst-bubble-user {
    background: linear-gradient(135deg, #2b1f4d 0%, #1e1b4b 100%);
    color: #fff;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-bottom-right-radius: 2px;
    white-space: pre-wrap;
}
.asst-bubble-bot {
    background: #14141c;
    border: 1px solid var(--border-color);
    color: #e4e4e7;
    border-bottom-left-radius: 2px;
    flex: 1;
}

.asst-proposals-container {
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 0.75rem;
}

.proposal-card {
    background: #101016;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    transition: all 0.15s ease;
}
.proposal-card.executed {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.04);
}
.proposal-card.rejected {
    border-color: rgba(156, 163, 175, 0.25);
    opacity: 0.7;
}

.proposal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.proposal-badge {
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.badge-create_persona {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}
.badge-update_persona {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}
.badge-create_scene {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}
.badge-update_scene {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.proposal-target-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.92rem;
}

.proposal-summary {
    font-size: 0.84rem;
    color: var(--text-main);
    line-height: 1.4;
}

.proposal-details-box {
    background: #09090d;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    color: #d4d4d8;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.45;
}

.proposal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.btn-signoff {
    background: #059669;
    color: #fff;
    border: none;
    padding: 0.4rem 0.9rem;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-signoff:hover {
    background: #047857;
}

.btn-reject {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-reject:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}

.proposal-status-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.status-applied {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.status-rejected {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ===== Architect: markdown, status, review cards ===== */
.asst-bubble-bot { min-width: 0; }
.asst-text-body .md > :first-child { margin-top: 0; }
.asst-text-body .md > :last-child { margin-bottom: 0; }
.md .md-p { margin: 0.45rem 0; }
.md .md-h { color: var(--accent-gold); margin: 0.85rem 0 0.3rem; font-size: 0.95rem; line-height: 1.3; }
.md h3.md-h { font-size: 1.02rem; color: #fff; }
.md .md-list { margin: 0.35rem 0; padding-left: 1.3rem; }
.md .md-list .md-list { margin: 0.15rem 0; }
.md .md-list li { margin: 0.15rem 0; }
.md code { background: #1f1f2e; padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.82em; }
.md .md-pre { background: #09090d; border: 1px solid var(--border-color); padding: 0.55rem 0.7rem; border-radius: 5px; overflow-x: auto; margin: 0.5rem 0; }
.md .md-pre code { background: none; padding: 0; font-size: 0.8rem; white-space: pre; }
.md .md-quote { margin: 0.5rem 0; padding: 0.1rem 0.8rem; border-left: 3px solid var(--accent-gold); color: var(--text-muted); }
.md .md-hr { border: none; border-top: 1px solid var(--border-color); margin: 0.75rem 0; }
.md a { color: #7dd3fc; text-decoration: underline; }
.md-table-wrap { overflow-x: auto; margin: 0.5rem 0; }
.md-table { border-collapse: collapse; font-size: 0.82rem; min-width: 50%; }
.md-table th, .md-table td { border: 1px solid var(--border-color); padding: 0.3rem 0.6rem; text-align: left; vertical-align: top; }
.md-table th { background: #1a1a24; color: var(--accent-gold); }

.asst-status { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.76rem; color: var(--text-muted); font-style: italic; }
.asst-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-gold); animation: asstPulse 1s ease-in-out infinite; }
@keyframes asstPulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.asst-proposals-title { font-size: 0.75rem; font-weight: 700; color: var(--accent-gold); text-transform: uppercase; letter-spacing: 0.05em; }
.proposal-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.35); color: #fca5a5; border-radius: 5px; padding: 0.4rem 0.6rem; font-size: 0.78rem; line-height: 1.4; }
.btn-signoff:disabled { background: #374151; color: #9ca3af; cursor: not-allowed; }

.chg-list { display: flex; flex-direction: column; gap: 0.4rem; }
.chg-group { background: #09090d; border: 1px solid var(--border-color); border-left-width: 3px; border-radius: 5px; }
.chg-group.chg-added { border-left-color: #10b981; }
.chg-group.chg-changed { border-left-color: #fbbf24; }
.chg-group.chg-removed { border-left-color: #ef4444; }
.chg-group.chg-note { border-left-color: #60a5fa; }
.chg-group > summary { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.65rem; cursor: pointer; font-size: 0.8rem; list-style: none; user-select: none; }
.chg-group > summary::-webkit-details-marker { display: none; }
.chg-group > summary::before { content: '\25B8'; color: var(--text-muted); font-size: 0.7rem; transition: transform 0.12s; }
.chg-group[open] > summary::before { transform: rotate(90deg); }
.chg-scope { font-weight: 600; color: #fff; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chg-kind { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.05rem 0.4rem; border-radius: 999px; background: #1f1f2e; color: var(--text-muted); }
.chg-added .chg-kind { color: #34d399; background: rgba(16, 185, 129, 0.14); }
.chg-changed .chg-kind { color: #fbbf24; background: rgba(251, 191, 36, 0.14); }
.chg-removed .chg-kind { color: #f87171; background: rgba(239, 68, 68, 0.14); }
.chg-note .chg-kind { color: #60a5fa; background: rgba(96, 165, 250, 0.14); }
.chg-count { font-size: 0.7rem; color: var(--text-muted); }
.chg-lines { max-height: 280px; overflow-y: auto; border-top: 1px solid var(--border-color); padding: 0.25rem 0; }
.chg-line { display: flex; gap: 0.5rem; padding: 0.12rem 0.65rem; font-size: 0.78rem; line-height: 1.45; }
.chg-op { width: 0.8rem; flex-shrink: 0; font-weight: 700; font-family: monospace; text-align: center; }
.chg-text { white-space: pre-wrap; word-break: break-word; min-width: 0; }
.chg-op-add { background: rgba(16, 185, 129, 0.07); color: #a7f3d0; }
.chg-op-add .chg-op { color: #34d399; }
.chg-op-del { background: rgba(239, 68, 68, 0.07); color: #fecaca; }
.chg-op-del .chg-op { color: #f87171; }
.chg-op-mod { color: #fde68a; font-weight: 600; }
.chg-op-mod .chg-op { color: #fbbf24; }
.chg-op-none { color: #bfdbfe; }

/* ===== Settings > AI Configuration ===== */
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.78rem; }
.ai-config { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 760px) { .ai-config { grid-template-columns: 1fr; } }
.ai-config-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.ai-config-heading { font-weight: 700; color: var(--accent-gold); }
.ai-config-hint { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 0.7rem; }
.ai-preset-list { display: flex; flex-direction: column; gap: 0.45rem; }
.ai-preset-empty { font-size: 0.8rem; color: var(--text-muted); padding: 0.5rem 0; }
.ai-preset-card {
    display: flex; flex-direction: column; gap: 0.2rem; text-align: left; width: 100%;
    padding: 0.55rem 0.7rem; border-radius: 8px; cursor: pointer; color: var(--text-main);
    background: var(--card-bg); border: 1px solid var(--border-color); font: inherit; transition: border-color 0.15s, background 0.15s;
}
.ai-preset-card:hover { background: var(--card-hover); }
.ai-preset-card.selected { border-color: var(--primary); background: rgba(139, 92, 246, 0.1); }
.ai-preset-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.ai-preset-name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-preset-model { font-size: 0.76rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-preset-bottom { display: flex; justify-content: space-between; align-items: center; min-height: 1.4rem; }
.ai-preset-meta { font-size: 0.7rem; color: var(--text-muted); }
.ai-active-pill { font-size: 0.7rem; font-weight: 600; color: var(--success); }
.ai-use-btn { padding: 0.12rem 0.55rem; font-size: 0.72rem; }
.ai-badge { font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px; flex-shrink: 0; }
.ai-badge-openrouter { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.ai-badge-lmstudio { background: rgba(251, 191, 36, 0.15); color: var(--accent-gold); }
.ai-config-editor { display: flex; flex-direction: column; gap: 0.9rem; padding: 1rem; border-radius: 8px; background: #181824; border: 1px solid var(--border-color); }
.ai-editor-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.ai-editor-title { font-weight: 700; font-size: 0.95rem; }
.ai-editor-status { font-size: 0.78rem; color: var(--text-muted); text-align: right; }
.ai-editor-status.ok { color: var(--success); }
.ai-editor-status.err { color: #f87171; }
.ai-segmented { display: inline-flex; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; align-self: flex-start; }
.ai-seg-btn { background: #111117; color: var(--text-muted); border: none; padding: 0.45rem 1rem; font: inherit; font-size: 0.85rem; cursor: pointer; }
.ai-seg-btn + .ai-seg-btn { border-left: 1px solid var(--border-color); }
.ai-seg-btn span { font-size: 0.68rem; opacity: 0.7; margin-left: 0.25rem; }
.ai-seg-btn.active { background: var(--primary); color: #fff; font-weight: 600; }
.ai-backend-fields { display: flex; flex-direction: column; gap: 0.9rem; }
.ai-input-row { display: flex; gap: 0.5rem; }
.ai-input-row .form-input { flex: 1; min-width: 0; }
.ai-field-note { font-size: 0.74rem; color: var(--text-muted); }
.ai-field-note.err { color: #f87171; }
.ai-field-note.ok { color: var(--success); }
.ai-advanced { display: flex; flex-direction: column; gap: 0.6rem; }
.ai-advanced summary { cursor: pointer; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.ai-advanced .form-group + .form-group { margin-top: 0.6rem; }
.ai-editor-actions { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border-color); }
.ai-spacer { flex: 1; }
.ai-danger { color: #f87171; }
.ai-config-general { margin-top: 1.25rem; padding-top: 0.9rem; border-top: 1px solid var(--border-color); }
.ai-check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: 0.85rem; color: #e4e4e7; }
.ai-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); cursor: pointer; }

/* ===== Image generation debug screen ===== */
.imgdbg-card { max-width: 1180px; width: 94vw; height: 88vh; display: flex; flex-direction: column; }
.imgdbg-body { flex: 1; display: flex; min-height: 0; border-top: 1px solid var(--border-color); }
.imgdbg-list-pane { width: 260px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid var(--border-color); background: #101015; }
.imgdbg-list-head { display: flex; justify-content: space-between; padding: 0.5rem 0.75rem; font-size: 0.75rem; color: var(--text-muted); position: sticky; top: 0; background: #101015; border-bottom: 1px solid var(--border-color); }
.imgdbg-item { padding: 0.5rem 0.75rem; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.78rem; }
.imgdbg-item:hover { background: rgba(255,255,255,0.04); }
.imgdbg-item.active { background: rgba(212,175,55,0.12); border-left: 3px solid var(--accent-gold); }
.imgdbg-item .imgdbg-sub { color: var(--text-muted); font-size: 0.7rem; margin-top: 0.15rem; }
.imgdbg-detail-pane { flex: 1; overflow-y: auto; padding: 1rem; background: #09090d; }
.imgdbg-empty { color: var(--text-muted); font-size: 0.85rem; padding: 2rem; text-align: center; }
.imgdbg-summary { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.9rem; line-height: 1.5; }
.imgdbg-attempts { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 0.9rem; }
.imgdbg-attempt { background: #14141c; border: 1px solid var(--border-color); border-radius: 8px; padding: 0.7rem; display: flex; flex-direction: column; gap: 0.5rem; }
.imgdbg-attempt.selected { border-color: #22c55e; box-shadow: 0 0 0 1px rgba(34,197,94,0.35); }
.imgdbg-attempt.rejected { border-color: rgba(239,68,68,0.45); }
.imgdbg-attempt img { width: 100%; max-height: 340px; object-fit: contain; background: #000; border-radius: 6px; cursor: zoom-in; }
.imgdbg-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; font-weight: 600; }
.imgdbg-badge { font-size: 0.68rem; padding: 0.1rem 0.45rem; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.imgdbg-badge.selected { background: rgba(34,197,94,0.18); color: #4ade80; }
.imgdbg-badge.rejected { background: rgba(239,68,68,0.18); color: #f87171; }
.imgdbg-badge.generated, .imgdbg-badge.failed { background: rgba(148,163,184,0.18); color: #cbd5e1; }
.imgdbg-note { font-size: 0.78rem; line-height: 1.45; color: #e4e4e7; background: rgba(0,0,0,0.3); border-left: 3px solid var(--accent-gold); padding: 0.4rem 0.55rem; border-radius: 3px; }
.imgdbg-attempt.rejected .imgdbg-note { border-left-color: #f87171; }
.imgdbg-attempt.selected .imgdbg-note { border-left-color: #22c55e; }
.imgdbg-meta { font-family: monospace; font-size: 0.7rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; }
.imgdbg-attempt details { font-size: 0.72rem; }
.imgdbg-attempt summary { cursor: pointer; color: var(--accent-blue); }
.imgdbg-attempt pre { margin: 0.35rem 0 0; padding: 0.5rem; background: #09090d; border-radius: 4px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.68rem; color: #e4e4e7; }
