/* btcedu dashboard - lightweight CSS */
:root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-hover: #1c2128;
    --border: #30363d;
    --text: #e6edf3;
    --text-dim: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --green: #3fb950;
    --yellow: #d29922;
    --red: #f85149;
    --orange: #d18616;
    --purple: #bc8cff;
    --radius: 6px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    /* iOS viewport height fallback - set by JS */
    --vh: 1vh;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    /* Allow body to scroll on desktop */
    overflow-y: auto;
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.topbar h1 {
    font-size: 18px;
    font-weight: 600;
    margin-right: 16px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.btn:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(180deg, #2da44e 0%, #238636 100%);
    border-color: #2ea043;
    color: #fff;
    font-weight: 500;
}
.btn-primary:hover {
    background: linear-gradient(180deg, #2ea043 0%, #26973d 100%);
    border-color: #2ea043;
}
.btn-danger {
    background: linear-gradient(180deg, #da3633 0%, #cf222e 100%);
    border-color: #da3633;
    color: #fff;
    font-weight: 500;
}
.btn-danger:hover {
    background: linear-gradient(180deg, #e5534b 0%, #da3633 100%);
}
.btn-success {
    background: linear-gradient(180deg, #2ea043 0%, #238636 100%);
    border-color: #2ea043;
    color: #fff;
    font-weight: 500;
}
.btn-success:hover {
    background: linear-gradient(180deg, #3fb950 0%, #2ea043 100%);
}
.btn-sm { padding: 2px 8px; font-size: 11px; }

/* Layout */
.main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    /* Use dynamic viewport height for iOS Safari support */
    min-height: 100dvh; /* Modern browsers */
    min-height: calc(var(--vh, 1vh) * 100); /* iOS fallback */
    height: auto;
}
.panel {
    overflow-y: auto;
    /* Enable iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    background: var(--bg);
}
.panel-left {
    border-right: 1px solid var(--border);
    background: var(--surface);
}

/* Filters */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.filters select, .filters input {
    padding: 4px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 12px;
}

/* Episode table */
.ep-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.ep-table thead {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.ep-table th {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 2px solid var(--border);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ep-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.ep-table tr { cursor: pointer; transition: background 0.15s ease; }
.ep-table tbody tr:hover { background: var(--surface-hover); }
.ep-table tbody tr.selected {
    background: rgba(88, 166, 255, 0.15);
    border-left: 3px solid var(--accent);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}
.badge-new { background: #1f6feb33; color: var(--accent); }
.badge-downloaded { background: #d2992233; color: var(--yellow); }
.badge-transcribed { background: #d1861633; color: var(--orange); }
.badge-chunked { background: #bc8cff33; color: var(--purple); }
.badge-generated { background: #3fb95033; color: var(--green); }
.badge-refined { background: #58a6ff33; color: var(--accent); }
.badge-completed { background: #3fb95033; color: var(--green); }
.badge-failed { background: #f8514933; color: var(--red); }
/* v2 pipeline status badges (Sprint 11) */
.badge-corrected { background: #bc8cff33; color: var(--purple); }
.badge-translated { background: #58a6ff33; color: var(--accent); }
.badge-adapted { background: #d1861633; color: var(--orange); }
.badge-chapterized { background: #3fb95033; color: var(--green); }
.badge-images_generated { background: #d2992233; color: var(--yellow); }
.badge-tts_done { background: #1f6feb33; color: var(--accent); }
.badge-rendered { background: #bc8cff33; color: var(--purple); }
.badge-approved { background: #3fb95033; color: var(--green); }
.badge-published { background: #f0a50033; color: #f0a500; }
/* Profile badge (Phase 4) */
.badge-profile { background: #004b8733; color: #5ba3d9; text-transform: none; font-size: 10px; }

/* File indicators */
.files-row {
    display: flex;
    gap: 2px;
}
.file-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    display: inline-block;
    title: attr(data-tip);
}
.file-dot.present { background: var(--green); }

/* Detail panel */
.detail-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.detail-header h2 {
    font-size: 15px;
    margin-bottom: 4px;
}
.detail-meta {
    color: var(--text-dim);
    font-size: 12px;
}
.detail-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.detail-actions label {
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.tab {
    padding: 6px 14px;
    cursor: pointer;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    font-size: 12px;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Content viewer */
.viewer {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    overflow: auto;
    /* Enable iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
    /* Use dynamic viewport height */
    max-height: 60vh;
    max-height: calc(var(--vh, 1vh) * 60);
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* What's new bar */
.whats-new {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    font-size: 12px;
    color: var(--text-dim);
    flex-wrap: wrap;
}
.wn-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.wn-new { background: #1f6feb33; color: var(--accent); }
.wn-failed { background: #f8514933; color: var(--red); }
.wn-incomplete { background: #d2992233; color: var(--yellow); }

/* Cost modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    max-height: calc(var(--vh, 1vh) * 85);
    overflow-y: auto;
    /* Enable iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
}
.modal h3 {
    margin-bottom: 16px;
    font-size: 18px;
    color: var(--text);
}
.modal table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.modal th, .modal td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.modal th { color: var(--text-dim); }

/* Toast */
.toast {
    position: fixed;
    bottom: 16px;
    right: 16px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
.toast-ok { background: #238636; color: #fff; }
.toast-err { background: #da3633; color: #fff; }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline spinner for job progress */
.spinner-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    font-size: 11px;
    color: var(--accent);
}
.spinner-text {
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Disabled action buttons */
.detail-actions button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Log viewer */
.log-viewer {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Placeholder */
.empty {
    color: var(--text-dim);
    text-align: center;
    padding: 40px;
}

/* Batch progress bar */
.batch-progress {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    font-size: 12px;
}

.batch-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.batch-label {
    font-weight: 600;
    color: var(--accent);
}

.batch-counts {
    color: var(--text-dim);
}

.batch-counts span {
    font-weight: 600;
    color: var(--text);
}

.batch-cost {
    color: var(--text-dim);
    margin-left: auto;
}

.batch-cost span {
    font-weight: 600;
    color: var(--green);
}

.batch-current {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-dim);
}

.batch-current span:first-child {
    color: var(--text);
}

/* Batch progress bar */
.batch-progress-bar {
    margin-top: 8px;
    background: var(--bg);
    border-radius: 4px;
    height: 20px;
    position: relative;
    overflow: hidden;
}

.batch-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #4a9eff);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.batch-progress-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    z-index: 1;
}

/* Channel selector */
.channel-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.channel-selector select {
    padding: 5px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}

.channel-selector select:hover {
    border-color: var(--accent);
}

/* Channel modal */
.channel-form {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.channel-form h4 {
    font-size: 13px;
    margin-bottom: 12px;
    color: var(--text-dim);
}

.modal-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
}

.channel-list h4 {
    font-size: 13px;
    margin-bottom: 12px;
    color: var(--text-dim);
}

.channel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.channel-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-weight: 600;
}

.channel-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

.channel-table tr:hover {
    background: var(--bg);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Mobile navigation */
.mobile-nav {
    display: none;
}
.mobile-back {
    display: none;
}

/* Episode cards (mobile view) */
.ep-cards {
    display: none;
    flex-direction: column;
    gap: 12px;
}
.ep-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ep-card:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.ep-card.selected {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
}
.ep-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.ep-card-title {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    margin: 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ep-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
}
.ep-card-retry {
    margin-left: auto;
    font-size: 11px;
    color: var(--orange);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
        height: auto;
    }
    .panel-left {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .topbar {
        gap: 6px;
        padding: 10px 12px;
    }
    .topbar h1 {
        font-size: 16px;
    }
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    /* Allow body to scroll naturally on mobile */
    body {
        overflow-y: auto;
        /* Prevent horizontal scroll */
        overflow-x: hidden;
    }

    /* Sticky header with safe area insets */
    .topbar {
        position: sticky;
        top: 0;
        z-index: 50;
        padding: max(12px, env(safe-area-inset-top)) 16px 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .topbar-row {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .topbar h1 {
        font-size: 18px;
        margin-right: 0;
        flex: 1;
    }

    .channel-selector {
        flex: 1;
        margin-right: 0;
    }

    .channel-selector select {
        width: 100%;
    }

    /* Mobile navigation */
    .mobile-nav {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        background: var(--surface);
    }

    .mobile-back {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        color: var(--text);
        cursor: pointer;
        font-size: 14px;
        transition: all 0.2s ease;
    }

    .mobile-back:hover {
        background: var(--surface-hover);
        border-color: var(--accent);
    }

    /* Single column layout - let body scroll naturally */
    .main {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: auto;
        /* No fixed height - let content determine height */
    }

    /* Hide desktop table, show cards */
    .ep-table {
        display: none;
    }

    .ep-cards {
        display: flex;
    }

    /* Panel adjustments - no fixed heights, natural scrolling */
    .panel {
        padding: 16px;
        /* Remove overflow constraints on mobile */
        overflow-y: visible;
        height: auto;
    }

    .panel-left {
        border-right: none;
        border-bottom: none;
    }

    /* Filters */
    .filters {
        flex-direction: column;
        gap: 8px;
    }

    .filters select,
    .filters input {
        width: 100%;
    }

    /* Detail header */
    .detail-header h2 {
        font-size: 16px;
        line-height: 1.4;
    }

    .detail-meta {
        font-size: 12px;
        line-height: 1.6;
    }

    /* Action buttons - larger tap targets */
    .detail-actions {
        gap: 8px;
    }

    .detail-actions .btn {
        min-height: 44px;
        padding: 8px 16px;
        font-size: 13px;
        flex: 1 1 calc(50% - 4px);
        text-align: center;
    }

    .detail-actions label {
        flex: 0 0 auto;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .detail-actions input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* Tabs - segmented control style */
    .tabs {
        flex-wrap: wrap;
        gap: 0;
        border-bottom: 2px solid var(--border);
    }

    .tab {
        padding: 10px 8px;
        font-size: 11px;
        flex: 1 1 auto;
        text-align: center;
        border-bottom: none;
        border: 1px solid var(--border);
        border-right: none;
        background: var(--bg);
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tab:first-child {
        border-top-left-radius: var(--radius);
    }

    .tab:last-child {
        border-right: 1px solid var(--border);
        border-top-right-radius: var(--radius);
    }

    .tab.active {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
        z-index: 1;
    }

    /* Content viewer - allow natural scrolling within its container */
    .viewer {
        max-height: 70vh;
        max-height: calc(var(--vh, 1vh) * 70);
        min-height: 300px;
        font-size: 13px;
        /* Enable smooth momentum scrolling on iOS */
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }

    /* Batch progress - bottom drawer style */
    .batch-progress {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 40;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .batch-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .batch-cost {
        margin-left: 0;
    }

    /* What's new bar */
    .whats-new {
        padding: 8px 16px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    /* Modals */
    .modal {
        width: 95%;
        max-width: none;
        padding: 20px;
        max-height: 90vh;
        max-height: calc(var(--vh, 1vh) * 90);
    }

    .modal h3 {
        font-size: 16px;
    }

    /* Channel modal */
    .modal-input {
        font-size: 16px; /* Prevent iOS zoom on focus */
    }

    /* Toast */
    .toast {
        bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
        right: 16px;
        left: 16px;
        text-align: center;
    }

    /* Mobile view state management - hide panels not in current view */
    .mobile-list-view .panel:not(.panel-left) {
        display: none;
    }

    .mobile-detail-view .panel-left {
        display: none;
    }

    .mobile-detail-view .mobile-nav {
        display: flex;
    }
}

/* Review system */
.review-badge {
    display: none;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: top;
}
.review-panel {
    padding: 12px 16px;
}
.review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.review-header h2 {
    font-size: 16px;
}
.review-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-height: 70vh;
    min-height: calc(var(--vh, 1vh) * 70);
}
.review-list {
    overflow-y: auto;
    max-height: 80vh;
    max-height: calc(var(--vh, 1vh) * 80);
}
.review-detail {
    overflow-y: auto;
    max-height: 80vh;
    max-height: calc(var(--vh, 1vh) * 80);
}
.review-section-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 8px 0 4px;
    letter-spacing: 0.5px;
}
.review-item {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.review-item:hover {
    background: var(--surface-hover);
}
.review-item.selected {
    background: rgba(88, 166, 255, 0.15);
    border-color: var(--accent);
}
.review-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.review-item-stage {
    font-size: 11px;
    color: var(--text-dim);
}
.review-item-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.review-item-time {
    font-size: 11px;
    color: var(--text-dim);
}
.badge-review-pending { background: #d2992233; color: var(--yellow); }
.badge-review-in-review { background: #58a6ff33; color: var(--accent); }
.badge-review-approved { background: #3fb95033; color: var(--green); }
.badge-review-rejected { background: #f8514933; color: var(--red); }
.badge-review-changes-requested { background: #d2992233; color: var(--yellow); }

.review-detail-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.review-detail-header h3 {
    font-size: 15px;
    margin-bottom: 4px;
}
.review-detail-meta {
    font-size: 12px;
    color: var(--text-dim);
}

/* Diff viewer */
.diff-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.diff-summary-total {
    font-weight: 600;
    font-size: 13px;
}
.diff-type-badge {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}
.diff-type-badge.replace { background: #d2992233; color: var(--yellow); }
.diff-type-badge.insert { background: #3fb95033; color: var(--green); }
.diff-type-badge.delete { background: #f8514933; color: var(--red); }
.diff-type-badge.tier1 { background: #3b82f633; color: #3b82f6; } /* Blue for T1 (mechanical) */
.diff-type-badge.tier2 { background: #f9731633; color: #f97316; } /* Orange for T2 (editorial) */

.diff-category-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-top: 8px;
    flex-wrap: wrap;
}
.diff-category-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.diff-changes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto;
}
.diff-change {
    padding: 8px 12px;
    border-radius: var(--radius);
    border-left: 3px solid var(--border);
    background: var(--surface);
    font-size: 13px;
}
.diff-change.replace { border-left-color: var(--yellow); }
.diff-change.insert { border-left-color: var(--green); }
.diff-change.delete { border-left-color: var(--red); }
.diff-change.adaptation.tier1 { border-left-color: #3b82f6; } /* Blue for T1 */
.diff-change.adaptation.tier2 { border-left-color: #f97316; } /* Orange for T2 */

.diff-type-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-right: 8px;
}
.diff-tier-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-right: 8px;
    padding: 2px 6px;
    border-radius: 8px;
}
.diff-change.tier1 .diff-tier-label {
    background: #3b82f633;
    color: #3b82f6;
}
.diff-change.tier2 .diff-tier-label {
    background: #f9731633;
    color: #f97316;
}
.diff-category-label {
    font-size: 9px;
    font-weight: 500;
    text-transform: lowercase;
    color: var(--text-dim);
    margin-right: 8px;
    padding: 2px 5px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
}
.diff-original {
    text-decoration: line-through;
    color: var(--red);
}
.diff-corrected {
    color: var(--green);
    font-weight: 500;
}
.diff-adapted {
    color: #3b82f6;
    font-weight: 500;
}
.diff-arrow {
    color: var(--text-dim);
}
.diff-context {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

.diff-sidebyside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.diff-side h4 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-dim);
}
.diff-text {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* Review actions */
.review-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.btn-warning {
    background: linear-gradient(180deg, #d29922 0%, #b08000 100%);
    border-color: #d29922;
    color: #fff;
    font-weight: 500;
}
.btn-warning:hover {
    background: linear-gradient(180deg, #e0a520 0%, #c09000 100%);
}
.review-feedback-panel {
    margin: 12px 0;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.review-feedback-panel h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.star-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 8px;
}
.star-label {
    font-size: 13px;
    color: var(--muted);
    margin-right: 6px;
}
.star-rating .star {
    font-size: 22px;
    cursor: pointer;
    color: var(--orange, #f90);
    transition: transform 0.1s;
    user-select: none;
}
.star-rating .star:hover {
    transform: scale(1.2);
}
.star-value {
    font-size: 12px;
    color: var(--muted);
    margin-left: 6px;
}
.decision-stars {
    color: var(--orange, #f90);
    font-size: 13px;
    margin-left: 4px;
}
.review-notes-textarea {
    display: block;
    width: 100%;
    min-height: 80px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}
.review-notes-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Decision history */
.review-decisions {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.review-decisions h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dim);
}
.review-decision-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.review-decision-time {
    font-size: 11px;
    color: var(--text-dim);
}
.review-decision-notes {
    width: 100%;
    font-size: 12px;
    color: var(--text-dim);
    padding: 4px 8px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-top: 2px;
}

@media (max-width: 768px) {
    .review-layout {
        grid-template-columns: 1fr;
    }
    .diff-sidebyside {
        grid-template-columns: 1fr;
    }
    .review-actions {
        flex-wrap: wrap;
    }
    .review-actions .btn {
        flex: 1 1 calc(50% - 4px);
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .topbar h1 {
        font-size: 16px;
    }

    .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .detail-actions .btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .tab {
        font-size: 10px;
        padding: 8px 4px;
    }

    .ep-card {
        padding: 10px;
    }

    .ep-card-title {
        font-size: 13px;
    }

    .modal {
        padding: 16px;
    }
}

/* ── TTS Audio Panel (Sprint 8) ──────────────────────────── */
.tts-panel {
    padding: 12px;
}
.tts-summary {
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: var(--fg-muted);
}
.tts-chapter-row {
    background: var(--surface);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.tts-chapter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.tts-duration {
    background: var(--accent);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.8em;
}
.tts-chars {
    color: var(--fg-muted);
    font-size: 0.8em;
}
.tts-player {
    width: 100%;
    height: 32px;
}

/* Video panel (Sprint 10) */
.video-panel {
    padding: 12px;
}
.video-summary {
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: var(--fg-muted);
}
.video-player {
    margin-bottom: 16px;
}
.video-player video {
    border-radius: 6px;
    display: block;
}
.video-chapters {
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 6px;
}
.video-chapter-row {
    display: flex;
    gap: 12px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}
.video-chapter-row:last-child {
    border-bottom: none;
}
.video-chapter-id {
    flex: 1;
    color: var(--text);
}
.video-duration {
    background: var(--accent);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.8em;
}
.video-transition {
    color: var(--fg-muted);
    font-size: 0.8em;
}

/* Review video player (Sprint 10) */
.review-video-player {
    margin: 16px 0;
}
.review-video-player video {
    width: 100%;
    max-width: 800px;
    background: #000;
    border-radius: 6px;
}
.review-render-info {
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 6px;
    margin: 12px 0;
    font-size: 0.9em;
    color: var(--fg-muted);
}
.review-script-panel {
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 6px;
    margin: 12px 0;
}
.review-script-list {
    margin-top: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}
.review-script-chapter {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.review-script-chapter:last-child {
    border-bottom: none;
}
.review-script-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.review-script-text {
    white-space: pre-wrap;
    color: var(--text);
}

/* Publish panel (Sprint 11) */
.publish-panel {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.yt-link {
    color: #f0a500;
    text-decoration: none;
    font-weight: 500;
}
.yt-link:hover {
    text-decoration: underline;
}

/* ── Stock Images Panel ───────────────────────────────── */
.stock-panel { padding: 0.5em 0; }
.stock-summary {
    padding: 0.5em 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5em;
}
.stock-actions {
    padding: 0.5em 0;
    display: flex;
    gap: 0.5em;
}
.stock-chapter {
    margin-bottom: 1.5em;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75em;
}
.stock-chapter-header {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 0.5em;
}
.stock-query {
    color: var(--muted);
    font-size: 0.85em;
}
.stock-grid {
    display: flex;
    gap: 0.75em;
    overflow-x: auto;
    padding-bottom: 0.5em;
}
.stock-thumb {
    flex: 0 0 200px;
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 0.25em;
    position: relative;
    background: var(--surface);
    transition: border-color 0.15s;
}
.stock-thumb:hover { border-color: var(--blue); }
.stock-thumb.selected { border-color: var(--orange, #f90); }
.stock-thumb.pinned { border-color: var(--green); }
.stock-thumb img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}
.stock-rank-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.75em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 1;
}
.stock-thumb-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    padding: 0.25em 0;
    color: var(--muted);
}
.stock-locked {
    color: var(--green);
    font-weight: 700;
    font-size: 0.7em;
}
.stock-pin-btn {
    width: 100%;
    font-size: 0.8em;
    margin-top: 0.25em;
}
.stock-photographer { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Phase 3: Intent tags and trap warnings */
.stock-intents {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 8px;
}

.stock-intent-tag {
    font-size: 0.75em;
    padding: 2px 6px;
    background: var(--accent, #58a6ff);
    color: #fff;
    border-radius: 10px;
    white-space: nowrap;
}

.stock-trap-warning {
    color: var(--yellow, #d29922);
    font-size: 0.9em;
    cursor: help;
}

/* ── Next Action Block (Phase 1 Review UX) ──────────── */
.next-action {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 8px 0 12px;
    border-left: 4px solid;
}
.next-action-review {
    background: rgba(210, 153, 34, 0.08);
    border-left-color: var(--yellow);
}
.next-action-approved {
    background: rgba(63, 185, 80, 0.08);
    border-left-color: var(--green);
}
.next-action-failed {
    background: rgba(248, 81, 73, 0.08);
    border-left-color: var(--red);
}
.next-action-icon {
    font-size: 1.4em;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}
.next-action-body strong {
    display: block;
    margin-bottom: 4px;
}
.next-action-body p {
    margin: 0 0 8px;
    opacity: 0.8;
    font-size: 0.9em;
}
.next-action-body .btn {
    margin-right: 6px;
}

/* ── Pipeline Stepper ────────────────────────────────── */
.pipeline-stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin: 10px 0;
    overflow-x: auto;
    padding: 4px 0 8px;
}

/* Individual stage column */
.ps-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    flex-shrink: 0;
}

/* Gate stages are visually narrower */
.ps-gate {
    min-width: 36px;
}

/* Blob (circle indicator) */
.ps-blob {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text-dim);
    transition: all 0.2s;
}

/* Gate blobs are smaller */
.ps-gate .ps-blob {
    width: 18px;
    height: 18px;
    font-size: 9px;
    margin-top: 3px;
}

/* State colors */
.ps-done .ps-blob {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.ps-active .ps-blob {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    animation: psPulse 2s ease-in-out infinite;
}

.ps-paused .ps-blob {
    background: var(--yellow);
    border-color: var(--yellow);
    color: #fff;
}

.ps-failed .ps-blob {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.ps-pending .ps-blob {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-dim);
}

@keyframes psPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(88, 166, 255, 0); }
}

/* Labels */
.ps-label {
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
}

.ps-done .ps-label { color: var(--green); }
.ps-active .ps-label { color: var(--accent); font-weight: 600; }
.ps-paused .ps-label { color: var(--yellow); }
.ps-failed .ps-label { color: var(--red); }

/* Duration sub-label */
.ps-duration {
    font-size: 8px;
    color: var(--text-dim);
    opacity: 0.7;
}

/* Connector lines between stages */
.ps-connector {
    flex: 1 0 8px;
    max-width: 24px;
    height: 2px;
    margin-top: 12px;  /* Aligns with blob center */
    background: var(--border);
}

.ps-connector.ps-done {
    background: var(--green);
}

/* Summary line */
.ps-summary {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
    margin-bottom: 4px;
}

/* Mobile: allow horizontal scroll, reduce label size */
@media (max-width: 768px) {
    .pipeline-stepper {
        padding-bottom: 12px;
        /* Smooth momentum scrolling on iOS */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .ps-stage {
        min-width: 40px;
    }
    .ps-gate {
        min-width: 30px;
    }
    .ps-label {
        font-size: 8px;
    }
}

/* ── Stage Detail Panel (Jenkins-style) ───────────────────────────── */

/* Clickable stages */
.ps-clickable {
    cursor: pointer;
}

.ps-clickable:hover .ps-blob {
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
}

.ps-clickable:hover .ps-label {
    color: var(--accent);
}

/* Stage detail panel */
.stage-detail-panel {
    padding: 16px;
    max-width: 700px;
}

.stage-detail-title {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--text);
}

.stage-detail-empty {
    color: var(--text-dim);
    font-style: italic;
}

.stage-detail-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.stage-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stage-badge.badge-success {
    background: var(--green);
    color: #fff;
}

.stage-badge.badge-failed {
    background: var(--red);
    color: #fff;
}

.stage-badge.badge-running {
    background: var(--accent);
    color: #fff;
    animation: psPulse 2s ease-in-out infinite;
}

.stage-detail-meta {
    color: var(--text-dim);
    font-size: 12px;
}

.stage-detail-section {
    margin-bottom: 16px;
}

.stage-detail-section h4 {
    margin: 0 0 6px;
    font-size: 13px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stage-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stage-detail-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
}

.stage-detail-table td:first-child {
    color: var(--text-dim);
    width: 120px;
}

.stage-detail-error pre {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--red);
    border-radius: 6px;
    padding: 10px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--red);
    max-height: 200px;
    overflow-y: auto;
}

.stage-detail-actions {
    margin: 16px 0;
}

/* Run history table */
.stage-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.stage-history-table th {
    text-align: left;
    padding: 4px 6px;
    border-bottom: 2px solid var(--border);
    color: var(--text-dim);
    font-weight: 600;
}

.stage-history-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border);
}

.stage-history-table .row-success td:nth-child(2) { color: var(--green); }
.stage-history-table .row-failed td:nth-child(2) { color: var(--red); }

/* Log lines within stage detail */
.stage-log-pre {
    background: var(--bg-inset, #161b22);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 250px;
    overflow-y: auto;
    color: var(--text-dim);
}

/* ── Phase 4: Video candidate styles ──────────────────────────────────── */

/* Badge overlay showing duration and play icon */
.stock-video-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 700;
    pointer-events: none;
}

/* Wrapper for thumbnail image (needed for absolute badge positioning) */
.stock-thumb-media {
    position: relative;
    display: block;
    width: 100%;
    cursor: pointer;
}

.stock-thumb-media img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

/* Inline video preview container */
.stock-video-preview {
    margin-top: 0.5em;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.stock-video-preview video {
    width: 100%;
    max-height: 300px;
    display: block;
}

/* ── Phase 5: Granular diff item actions ─────────────────────────── */

.diff-item-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 4px;
}

.diff-item-btn {
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 12px;
    border: 1px solid currentColor;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.diff-item-btn.accept  { color: var(--green, #2a9d4a); }
.diff-item-btn.reject  { color: var(--red, #c0392b); }
.diff-item-btn.edit    { color: #4f46e5; }
.diff-item-btn.reset   { color: var(--text-dim, #888); }

.diff-item-btn.accept.active  { background: var(--green, #2a9d4a); color: #fff; }
.diff-item-btn.reject.active  { background: var(--red, #c0392b); color: #fff; }
.diff-item-btn.edit.active    { background: #4f46e5; color: #fff; }
.diff-item-btn.reset.active   { background: var(--text-dim, #888); color: #fff; }

.diff-item-accepted {
    background: rgba(63, 185, 80, 0.08);
    border-left: 3px solid #3fb950;
}

.diff-item-rejected {
    background: rgba(248, 81, 73, 0.08);
    border-left: 3px solid #f85149;
}
.diff-item-rejected .diff-corrected,
.diff-item-rejected .diff-adapted {
    text-decoration: line-through;
    opacity: 0.6;
}

.diff-item-edited {
    background: rgba(79, 70, 229, 0.08);
    border-left: 3px solid #4f46e5;
}

.diff-item-unchanged {
    background: rgba(139, 148, 158, 0.08);
    border-left: 3px solid #8b949e;
}

.diff-edit-inline {
    margin-top: 4px;
}

.diff-edit-textarea {
    width: 100%;
    font-size: 13px;
    font-family: inherit;
    padding: 6px 8px;
    border: 1px solid var(--border, #30363d);
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
    background: var(--surface, #161b22);
    color: var(--text, #e6edf3);
}

.diff-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.diff-item-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-dim, #8b949e);
    margin-top: 4px;
    padding: 4px 0;
}

.diff-item-summary .dim-count { white-space: nowrap; }
.diff-item-summary .dim-count.accepted { color: #3fb950; }
.diff-item-summary .dim-count.rejected { color: #f85149; }
.diff-item-summary .dim-count.edited   { color: #4f46e5; }

/* ── Inline video preview (Phase 3a-3) ─────────────────── */
.video-inline-preview {
    margin: 10px 0 4px;
}
.video-inline-preview video {
    width: 100%;
    max-width: 640px;
    border-radius: var(--radius);
    background: #000;
    display: block;
}

/* ── SSE live indicator (Phase 3d) ─────────────────────── */
.sse-indicator {
    position: fixed;
    bottom: 16px;
    left: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    opacity: 0.6;
    z-index: 150;
    transition: background 0.4s, opacity 0.4s;
}
.sse-indicator.sse-connected {
    background: var(--green);
    opacity: 1;
    animation: ssePulse 3s ease-in-out infinite;
}
.sse-indicator.sse-error {
    background: var(--red);
    opacity: 1;
}
@keyframes ssePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.4); }
    50%       { box-shadow: 0 0 0 5px rgba(63, 185, 80, 0); }
}

/* ── Status summary bar (Phase 3c-2) ───────────────────── */
.status-summary {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 0;
    margin-bottom: 8px;
    font-size: 11px;
}
.status-summary-item {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s;
}
.status-summary-item:hover {
    border-color: var(--accent);
}
.status-summary-count {
    font-weight: 600;
    color: var(--text);
}

/* ── Cost chart canvas (Phase 3c-1) ────────────────────── */
#cost-chart-container {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
#cost-chart {
    border-radius: var(--radius);
}

/* ── TTS audio in review detail (Phase 3b-2) ───────────── */
.review-tts-audio {
    margin: 12px 0;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.review-tts-audio h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.review-tts-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.review-tts-label {
    font-size: 12px;
    min-width: 100px;
    color: var(--text);
    font-weight: 500;
}
.review-tts-player {
    flex: 1;
    min-width: 200px;
    height: 32px;
}

/* ── Badge missing statuses ─────────────────────────────── */
.badge-segmented       { background: #58a6ff33; color: var(--accent); }
.badge-frames_extracted { background: #bc8cff33; color: var(--purple); }
.badge-cost_limit      { background: #f8514933; color: var(--red); }
.badge-refined         { background: #58a6ff33; color: var(--accent); }

/* Analytics modal */
.analytics-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.analytics-tab {
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.analytics-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.analytics-panel { min-height: 200px; }
