:root {
    color-scheme: light;
    --color-bg: #F9FAFB;
    --color-surface: #FFFFFF;
    --color-border: #E5E7EB;
    --color-text: #1F2937;
    --color-muted: #6B7280;
    --color-primary: #4A90E2;
    --color-primary-dark: #3A7BC8;
    --color-secondary: #F5A623;
    --color-success: #10B981;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;
    --radius: 12px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --font-base: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body.app {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar Navigation */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.75rem 2rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.topbar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    flex-shrink: 0;
}

.topbar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.topbar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}

.topbar-nav .nav-link:hover {
    background: var(--color-bg);
    color: var(--color-primary);
    text-decoration: none;
}

.topbar-nav .nav-link.active {
    background: rgba(74, 144, 226, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.topbar-nav .nav-link .material-symbols-outlined {
    font-size: 20px;
    flex-shrink: 0;
}

.btn-create {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Full width main content for project detail pages */
.main-content.full-width {
    max-width: 100%;
    padding: 0;
}

/* Consistent spacing for all major sections */
.main-content > .card,
.main-content > section {
    margin-bottom: 2rem;
}

.main-content > .card:last-child,
.main-content > section:last-child {
    margin-bottom: 0;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--color-text);
    letter-spacing: -0.025em;
}

.page-subtitle {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    color: var(--color-muted);
}

/* Search Box */
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 220px;
    max-width: 288px;
}

.search-icon {
    color: var(--color-muted);
    font-size: 20px;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background: var(--color-surface);
    font: inherit;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Project Card */
.project-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.project-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.project-card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-status {
    font-size: 0.875rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.project-status.status-draft {
    color: var(--color-warning);
}

.project-status.status-ready,
.project-status.status-processing {
    color: var(--color-secondary);
}

.project-status.status-completed,
.project-status.status-complete {
    color: var(--color-success);
}

.project-status.status-failed {
    color: var(--color-danger);
}

.project-card-title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
}

.project-card-meta {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--color-muted);
}

.project-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: auto;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--color-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(74, 144, 226, 0.1);
    color: var(--color-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: #E5E7EB;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(31, 41, 55, 0.75);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* Forms */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-field label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
}

.optional {
    font-weight: 400;
    color: var(--color-muted);
}

input[type="text"],
select,
textarea {
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    padding: 0.625rem 0.75rem;
    font: inherit;
    background: var(--color-surface);
    transition: all 0.2s ease;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

textarea {
    resize: vertical;
}

.form-help {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--color-muted);
    line-height: 1.5;
}

/* Flash Messages */
.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.flash {
    padding: 1rem;
    border-radius: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.flash-success {
    background: #D1FAE5;
    border-color: var(--color-success);
    color: #065F46;
}

.flash-error {
    background: #FEE2E2;
    border-color: var(--color-danger);
    color: #991B1B;
}

/* Empty State */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--color-muted);
}

.empty-state h3 {
    margin: 0 0 0.5rem;
    color: var(--color-text);
    font-size: 1.25rem;
}

.empty-state p {
    margin: 0;
}

/* Material Icons */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Responsive */
@media (max-width: 1024px) {
    .topbar {
        padding: 0.75rem 1.5rem;
        gap: 1rem;
    }
    
    .topbar-nav .nav-link span:not(.material-symbols-outlined) {
        display: none;
    }
    
    .btn-create .truncate {
        max-width: 120px;
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .topbar-brand {
        flex: 1;
    }
    
    .topbar-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        padding-top: 0.5rem;
        border-top: 1px solid var(--color-border);
    }
    
    .btn-create {
        order: 2;
    }

    .main-content {
        padding: 1.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box {
        max-width: 100%;
        flex-basis: 100%;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2.5rem;
    background: #101833;
    color: #f9fbff;
    box-shadow: 0 8px 24px -12px rgba(10, 20, 40, 0.6);
}

.app-brand a {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.app-nav {
    display: flex;
    gap: 1rem;
}

.app-nav-link {
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease;
}

.app-nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.app-nav-link.is-active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.app-main {
    flex: 1;
    width: min(1600px, calc(100% - 4rem));
    margin: 2rem auto 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.app-footer {
    margin-top: auto;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.flash {
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.flash-success {
    border-color: rgba(13, 156, 107, 0.45);
}

.flash-error {
    border-color: rgba(214, 69, 69, 0.45);
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid rgba(16, 24, 51, 0.08);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 1.75rem 1rem;
    border-bottom: 1px solid rgba(16, 24, 51, 0.08);
}

.card-title {
    margin: 0;
    font-size: 1.15rem;
}

.card-subtitle {
    margin: 0.35rem 0 0;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.card-body {
    padding: 1.5rem 1.75rem;
}

.form,
.form-inline {
    padding: 1.5rem 1.75rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-inline {
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-field label {
    font-weight: 600;
}

input[type="text"],
select,
textarea {
    border-radius: 8px;
    border: 1px solid var(--color-border);
    padding: 0.65rem 0.75rem;
    font: inherit;
    background: #fff;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(55, 93, 251, 0.18);
}

textarea {
    resize: vertical;
}

.optional {
    font-weight: 400;
    color: var(--color-muted);
}

.form-help {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: rgba(55, 93, 251, 0.12);
    color: var(--color-primary-dark);
}

.btn-secondary:hover {
    background: rgba(55, 93, 251, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--color-primary-dark);
}

.btn-ghost:hover {
    background: rgba(55, 93, 251, 0.1);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #DC2626;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.85rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid rgba(16, 24, 51, 0.08);
}

.table tr:last-child td {
    border-bottom: none;
}

.table-actions {
    text-align: right;
}

.status-badge, .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge {
    background: rgba(55, 93, 251, 0.12);
    color: var(--color-primary-dark);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    margin-left: 0.5rem;
}

.status-draft {
    background: rgba(214, 138, 30, 0.15);
    color: var(--color-warning);
}

.status-ready {
    background: rgba(55, 93, 251, 0.15);
    color: var(--color-primary-dark);
}

.status-processing {
    background: rgba(55, 93, 251, 0.18);
    color: var(--color-primary-dark);
}

.status-completed {
    background: rgba(13, 156, 107, 0.18);
    color: var(--color-success);
}

.status-failed {
    background: rgba(214, 69, 69, 0.18);
    color: var(--color-danger);
}

.status-pending {
    background: rgba(16, 24, 51, 0.08);
    color: var(--color-muted);
}

.status-complete {
    background: rgba(13, 156, 107, 0.18);
    color: var(--color-success);
}

.status-running {
    background: rgba(55, 93, 251, 0.18);
    color: var(--color-primary-dark);
    animation: pulse 2s ease-in-out infinite;
}

.status-queued {
    background: rgba(108, 122, 137, 0.12);
    color: var(--color-muted);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.pipeline-board {
    display: grid;
    gap: 1.5rem;
}

/* Live full-pipeline progress panel */
.pipeline-progress-panel {
    padding: 0;
    margin-bottom: 1.5rem;
}

.pipeline-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pipeline-progress-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.pipeline-progress-badge {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(16, 24, 51, 0.08);
    color: var(--color-text);
}

.pipeline-progress-badge.is-running { background: rgba(59, 130, 246, 0.15); color: #2563EB; }
.pipeline-progress-badge.is-completed { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.pipeline-progress-badge.is-failed { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }

.pipeline-progress-stages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.pipeline-progress-stage {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(16, 24, 51, 0.03);
}

.pipeline-progress-stage.is-running { background: rgba(59, 130, 246, 0.08); }
.pipeline-progress-stage.is-completed { background: rgba(16, 185, 129, 0.08); }
.pipeline-progress-stage.is-failed { background: rgba(239, 68, 68, 0.08); }

.pipeline-progress-icon {
    font-size: 1.1rem;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
}

.pipeline-progress-stage.is-running .pipeline-progress-icon {
    /* no spin — uses pulsing dot instead */
}

.pipeline-running-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3B82F6;
    animation: pulseDot 1.4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.7); }
}

.pipeline-progress-label {
    font-weight: 600;
    flex: 0 0 auto;
}

.pipeline-progress-msg {
    color: var(--color-text-muted, #6B7280);
    font-size: 0.85rem;
    margin-left: auto;
    text-align: right;
}

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

.pipeline-step {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid rgba(16, 24, 51, 0.08);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.2s ease;
}

.pipeline-step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(16, 24, 51, 0.08);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.pipeline-step-header:hover {
    background: rgba(74, 144, 226, 0.02);
}

.pipeline-step-index {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(55, 93, 251, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-primary-dark);
    flex-shrink: 0;
}

.pipeline-step-meta {
    flex: 1;
}

.pipeline-step-meta h2 {
    margin: 0;
    font-size: 1.05rem;
}

.pipeline-step-meta p {
    margin: 0.35rem 0 0;
    color: var(--color-muted);
}

.pipeline-step-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.pipeline-step-toggle .material-symbols-outlined {
    font-size: 24px;
}

.pipeline-step.is-collapsed .pipeline-step-toggle {
    transform: rotate(-90deg);
}

.pipeline-step-body {
    padding: 1.25rem 1.5rem;
    display: block;
    max-height: 10000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 1;
}

.pipeline-step.is-collapsed .pipeline-step-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.pipeline-step-actions {
    display: flex;
    gap: 0.5rem;
}

.pipeline-step-actions.grouped {
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pipeline-step-actions.grouped form {
    margin: 0;
}

.step-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.language-runner {
    margin: 1.5rem 0;
}

.language-runner-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.language-runner-buttons form {
    margin: 0;
}

.stage-section {
    margin-top: 2rem;
}

.stage-section h3 {
    margin-bottom: 0.5rem;
}

.stage-section > p {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--color-muted);
}

.transcript-editors {
    margin-top: 2rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.transcript-editor-card {
    background: var(--color-surface);
    border: 1px solid rgba(16, 24, 51, 0.08);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.transcript-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.transcript-editor-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.srt-editor-inline {
    width: 100%;
    min-height: 240px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    resize: vertical;
}

.srt-editor-inline:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(55, 93, 251, 0.1);
}

.muted {
    color: var(--color-muted);
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--color-muted);
}

.empty-state h3 {
    margin: 0 0 0.35rem;
}

.step-list {
    list-style: none;
    margin: 0;
    padding: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step-list-item {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
}

.step-index {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(55, 93, 251, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.step-content h3 {
    margin: 0;
    font-size: 1rem;
}

.step-content p {
    margin: 0.35rem 0 0;
    color: var(--color-muted);
}

.breadcrumbs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

.project-summary .project-title {
    margin: 0;
    font-size: 1.6rem;
}

.project-reference {
    margin: 0.35rem 0 0;
    color: var(--color-muted);
}

.project-meta {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.project-status-display,
.project-languages,
.project-mode {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-status-display strong,
.project-languages strong,
.project-mode strong {
    font-size: 0.875rem;
    color: var(--color-muted);
    font-weight: 600;
}

.project-languages ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-languages li {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(16, 24, 51, 0.08);
    font-size: 0.85rem;
    font-weight: 600;
}

.project-mode form {
    margin: 0;
}

.project-mode label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

.project-mode input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

@media (max-width: 900px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .app-main {
        width: calc(100% - 2rem);
        margin: 1.5rem auto 3rem;
    }

    .project-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .pipeline-step-body {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .project-topbar-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .project-topbar-actions {
        width: 100%;
    }
    
    .project-topbar-actions .btn {
        flex: 1;
    }
    
    .project-topbar-meta {
        flex-direction: column;
        gap: 1.25rem;
    }
}

/* Upload Form Styles */
.upload-form {
    width: 100%;
    padding: 0;
}

.upload-form .form-group {
    margin-bottom: 1.5rem;
}

.upload-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.625rem;
    color: var(--color-text);
    font-size: 0.9375rem;
}

.upload-form input[type="file"] {
    display: block;
    width: 100%;
    padding: 1rem;
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.upload-form input[type="file"]:hover {
    border-color: var(--color-primary);
    background: var(--color-bg);
}

.upload-form input[type="file"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(55, 93, 251, 0.1);
}

.form-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-muted);
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Uploaded Files List */
.uploaded-files {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.uploaded-files h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.file-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.file-item,
.file-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.file-item:hover,
.file-list li:hover {
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.file-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.file-name {
    flex: 1;
    font-weight: 500;
    color: var(--color-text);
}

.file-language {
    padding: 0.375rem 0.875rem;
    background: var(--color-primary);
    color: white;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 24, 51, 0.8);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: 0 24px 48px rgba(16, 24, 51, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.modal-body {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--color-border);
}

.srt-editor {
    width: 100%;
    min-height: 400px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    resize: vertical;
    transition: border-color 0.2s ease;
}

.srt-editor:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(55, 93, 251, 0.1);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.editor-toolbar .form-help {
    margin: 0;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border);
    border-color: var(--color-muted);
}

.btn .icon {
    display: inline-block;
    margin-right: 0.25rem;
}

/* Segmentation Display */
.translation-group {
    margin-bottom: 2rem;
}

.translation-group h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    border-left: 3px solid var(--color-primary);
    border-radius: 4px;
}

.segment-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.segment-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    background: var(--color-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.segment-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-text);
    line-height: 1.5;
}

.segment-timing {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--color-muted);
    white-space: nowrap;
}

/* TTS Display */
.tts-clip-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
}

.tts-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-text);
    line-height: 1.5;
    min-width: 200px;
}

.tts-audio {
    width: 200px;
    height: 32px;
}

.error-text {
    color: #dc2626;
    font-size: 0.75rem;
    font-style: italic;
}

/* Project Detail Page Layout */
.project-topbar {
    margin-bottom: 2rem;
}

.project-topbar-content {
    padding: 1.5rem 2rem;
}

.project-topbar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.project-topbar-header .project-title {
    font-size: 1.75rem;
    margin: 0;
    line-height: 1.2;
}

.project-topbar-header .project-reference {
    margin: 0.5rem 0 0;
    color: var(--color-muted);
    font-size: 0.875rem;
}

.project-topbar-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.project-topbar-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.project-topbar-meta > div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-topbar-meta strong {
    font-size: 0.875rem;
    color: var(--color-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.project-topbar-meta .project-languages ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-topbar-meta .project-languages li {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(16, 24, 51, 0.08);
    font-size: 0.85rem;
    font-weight: 600;
}

.project-description span {
    color: var(--color-text);
    line-height: 1.5;
}

/* Single Column Layout for Project Detail Page */
.project-detail-layout {
    display: block;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

.project-steps-column {
    min-width: 0;
    padding: 2rem 2.5rem;
    background: transparent;
}

.project-steps-column .breadcrumbs {
    margin-bottom: 1.5rem;
}

.project-steps-column .project-topbar {
    margin-bottom: 2rem;
}

/* Morphing Upload Container */
.upload-morph-container {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 100%;
}

.upload-placeholder-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 2rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    box-shadow: var(--shadow-sm);
}

.upload-placeholder-cta:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(55, 93, 251, 0.08);
}

.upload-placeholder-cta .cta-icon {
    font-size: 3.2rem;
    color: var(--color-primary);
    margin-bottom: 1.2rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-placeholder-cta:hover .cta-icon {
    transform: scale(1.15) translateY(-3px);
}

.upload-placeholder-cta .cta-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.upload-placeholder-cta .cta-subtitle {
    font-size: 0.95rem;
    color: var(--color-muted);
    margin-bottom: 1.5rem;
    text-align: center;
    max-width: 480px;
}

.upload-placeholder-cta .cta-btn {
    pointer-events: none; /* Let clicking the area trigger click */
    padding: 0.6rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.upload-form-wrapper {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.95);
    opacity: 0;
}

.upload-morph-container.morphed .upload-form-wrapper {
    transform: scale(1);
    opacity: 1;
}

/* Aspect Ratio 16:9 Upload Cards */
.aspect-ratio-upload-card {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 2px dashed var(--color-border);
    border-radius: calc(var(--radius) * 0.75);
    background: var(--color-bg);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.aspect-ratio-upload-card:hover {
    border-color: var(--color-primary);
    background: var(--color-bg-secondary);
    box-shadow: 0 10px 25px rgba(55, 93, 251, 0.08);
    transform: translateY(-2px);
}

.aspect-ratio-upload-card.small-card {
    aspect-ratio: 1.85 / 1; /* slightly wider/shorter box layout for screen recordings grid */
    min-height: 100px;
}

.upload-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    pointer-events: none;
    padding: 1.5rem;
}

.upload-card-plus-icon {
    font-size: 2.2rem;
    color: var(--color-primary);
    background: rgba(55, 93, 251, 0.08);
    padding: 0.6rem;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.aspect-ratio-upload-card:hover .upload-card-plus-icon {
    transform: scale(1.15) rotate(90deg);
    background: var(--color-primary);
    color: #fff;
}

.upload-card-selected-file {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: center;
}

/* SRT Modal Tabs */
.srt-tabs-header {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.srt-tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.srt-tab-btn:hover {
    color: var(--color-text);
    background-color: var(--color-bg);
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.srt-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.srt-tab-content {
    animation: srtTabFadeIn 0.3s ease;
}

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

.project-srt-column {
    display: none;
}

/* Smooth scrollbar styling */
}

.project-srt-column::-webkit-scrollbar-track {
    background: transparent;
}

.project-srt-column::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.project-srt-column::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.srt-editors-panel {
    background: var(--color-surface);
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding: 0;
}

.srt-editors-panel.empty {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.srt-panel-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.srt-panel-subtitle {
    margin: 0 0 1.5rem 0;
    font-size: 0.875rem;
    color: var(--color-muted);
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.srt-editors-panel .transcript-editor-card {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--color-bg);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.srt-editors-panel .transcript-editor-card:last-child {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .project-steps-column {
        padding: 1.5rem;
    }
}