/**
 * Transcript Extraction Admin Panel
 * Modern, clean dashboard design
 */

/* Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
    --header-height: 64px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--gray-900);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-overlay.hidden {
    display: none;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.login-logo h1 span {
    color: var(--primary);
}

.login-logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color 0.15s;
}

.login-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--border-radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-100);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.logo {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-700);
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo h1 span {
    color: var(--primary);
}

.nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: var(--border-radius);
    margin-bottom: 4px;
    transition: all 0.15s ease;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--gray-800);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-700);
}

.version {
    font-size: 12px;
    color: var(--gray-500);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Views */
.view {
    display: none;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.view-header .subtitle {
    color: var(--gray-500);
    font-size: 14px;
}

.view-header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

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

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

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

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    margin-bottom: 8px;
    font-size: 14px;
}

.btn-back:hover {
    color: var(--gray-700);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.project-card-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-100);
}

.project-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.project-card-header .date {
    font-size: 12px;
    color: var(--gray-500);
}

.project-card-body {
    padding: 20px;
}

.project-stats-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-mini {
    text-align: center;
}

.stat-mini .value {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
}

.stat-mini .label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-mini.warning .value {
    color: var(--warning);
}

.project-card-footer {
    padding: 16px 20px;
    background: var(--gray-50);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: var(--success-light);
    color: #047857;
}

.status-badge.pending {
    background: var(--warning-light);
    color: #b45309;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Upload View */
.upload-container {
    max-width: 1000px;
}

.upload-section {
    margin-bottom: 24px;
}

.upload-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.upload-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.upload-card-header {
    display: flex;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--gray-100);
}

.upload-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-card-icon svg {
    width: 24px;
    height: 24px;
}

.upload-card-icon.roster {
    background: #dbeafe;
    color: #2563eb;
}

.upload-card-icon.questions {
    background: #fef3c7;
    color: #d97706;
}

.upload-card-icon.transcript {
    background: #d1fae5;
    color: #059669;
}

.upload-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.upload-card-header p {
    font-size: 13px;
    color: var(--gray-500);
}

.upload-card-body {
    padding: 20px;
}

.file-drop {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 16px;
}

.file-drop:hover,
.file-drop.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-drop svg {
    color: var(--gray-400);
    margin-bottom: 8px;
}

.file-drop span {
    display: block;
    color: var(--gray-500);
    font-size: 13px;
}

.file-drop .file-name {
    color: var(--primary);
    font-weight: 500;
    margin-top: 8px;
}

.upload-status {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--border-radius);
    font-size: 13px;
    display: none;
}

.upload-status.success {
    display: block;
    background: var(--success-light);
    color: #047857;
}

.upload-status.error {
    display: block;
    background: var(--danger-light);
    color: #b91c1c;
}

.upload-status.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-light);
    color: var(--primary-dark);
}

.upload-status.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Modal loading overlay */
.modal-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    border-radius: 12px;
}

.modal-loading-overlay .spinner {
    width: 40px;
    height: 40px;
}

.modal-loading-overlay .loading-text {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

/* Form Elements */
.field {
    margin-bottom: 16px;
}

.field label,
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.field input,
.field select,
.select-large,
.select-medium,
.select-full {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: white;
    transition: all 0.15s ease;
}

.field input:focus,
.field select:focus,
.select-large:focus,
.select-medium:focus,
.select-full:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.select-large {
    padding: 14px 16px;
    font-size: 15px;
}

.select-medium {
    width: auto;
    min-width: 200px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Flagged Items */
.flagged-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.flagged-item {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.flagged-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}

.flagged-item-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.flagged-item-meta .respondent {
    font-weight: 600;
    color: var(--gray-900);
}

.flagged-item-meta .question-num {
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.flagged-item-flags {
    display: flex;
    gap: 6px;
}

.flag-tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.flag-tag.missing {
    background: var(--danger-light);
    color: #b91c1c;
}

.flag-tag.ambiguous {
    background: var(--warning-light);
    color: #b45309;
}

.flagged-item-body {
    padding: 20px;
}

.flagged-item-question {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.flagged-item-answer {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.6;
    max-height: 150px;
    overflow-y: auto;
}

.flagged-item-answer.empty {
    color: var(--gray-400);
    font-style: italic;
}

.flagged-item-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Project Detail */
.project-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.stat-card .label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 600;
    color: var(--gray-900);
}

.stat-card.warning .value {
    color: var(--warning);
}

.stat-card.success .value {
    color: var(--success);
}

.section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.section h3 {
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-100);
}

.respondents-table {
    overflow-x: auto;
}

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

.respondents-table th,
.respondents-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.respondents-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
}

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

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.complete::before {
    background: var(--success);
}

.status-dot.pending::before {
    background: var(--gray-300);
}

.status-dot.flagged::before {
    background: var(--warning);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
}

.modal-content.modal-large {
    max-width: 640px;
}

.modal-content.modal-xlarge {
    max-width: 900px;
    max-height: 85vh;
}

/* Transcript Text Viewer */
.transcript-info {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--gray-600);
}

.transcript-text-container {
    max-height: 55vh;
    overflow-y: auto;
    padding: 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
}

.transcript-turn {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-100);
}

.transcript-turn:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.transcript-turn .speaker {
    font-weight: 600;
    color: var(--primary);
}

/* Button Link Style */
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--gray-900);
    color: white;
    padding: 14px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    color: var(--gray-300);
}

.empty-state h4 {
    font-size: 16px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 64px;
    }

    .logo h1,
    .nav-item span:not(.badge),
    .sidebar-footer {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .main {
        margin-left: 64px;
    }
}

/* Progress Stepper */
.stepper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
}

.step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.step.active .step-icon {
    background: var(--primary);
    color: white;
}

.step.completed .step-icon {
    background: var(--success);
    color: white;
}

.step.completed .step-icon::after {
    content: '✓';
}

.step-content {
    min-width: 100px;
}

.step-title {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}

.step.active .step-title {
    color: var(--primary);
}

.step.completed .step-title {
    color: var(--success);
}

.step-status {
    font-size: 12px;
    color: var(--gray-400);
}

.step.active .step-status {
    color: var(--primary);
}

.step.completed .step-status {
    color: var(--success);
}

.step-connector {
    width: 40px;
    height: 2px;
    background: var(--gray-200);
    margin: 0 8px;
    margin-top: 18px;
}

.step-connector.completed {
    background: var(--success);
}

/* Project Tabs */
.project-tabs {
    display: flex;
    gap: 0;
    background: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: var(--shadow);
    margin-bottom: 0;
    overflow: hidden;
}

.project-tab {
    flex: 1;
    padding: 16px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s ease;
}

.project-tab:hover {
    background: var(--gray-50);
    color: var(--gray-700);
}

.project-tab.active {
    background: white;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    min-width: 18px;
}

.project-tab-content {
    display: none;
    background: white;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.project-tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.tab-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    padding: 0;
    border: none;
}

.tab-actions {
    display: flex;
    gap: 12px;
}

/* Data Tables */
.data-table {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 12px 24px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.data-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
}

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

.data-table tr:hover td {
    background: var(--gray-50);
}

.data-table .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-icon {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-icon.danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* Transcript Grid */
.transcript-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 24px;
}

.transcript-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 16px;
}

.transcript-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.transcript-card .meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.transcript-card .stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.transcript-card .stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.transcript-card .stats .flagged {
    color: var(--warning);
}

/* Exports Grid */
.exports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 24px;
}

.export-card {
    text-align: center;
    padding: 32px 24px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.export-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.export-icon svg {
    width: 28px;
    height: 28px;
}

.export-icon.quant {
    background: var(--success-light);
    color: var(--success);
}

.export-icon.all {
    background: #fce7f3;
    color: #db2777;
}

.export-icon.regen {
    background: var(--warning-light);
    color: var(--warning);
}

.export-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.export-card p {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Info Box */
.info-box {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.info-box code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Duplicate Warning Box */
.duplicate-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.5;
}

/* Form Elements */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.help-text {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
}

.warning-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
}

/* Modal Variants */
.modal-content.modal-small {
    max-width: 400px;
}

/* Quantifiable Badge */
.quant-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--success-light);
    color: #047857;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.quant-badge.quant-off {
    background: var(--gray-700);
    color: var(--gray-300);
}

/* Sidebar Links */
.sidebar-link {
    display: block;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 8px;
    transition: color 0.15s ease;
}

.sidebar-link:hover {
    color: white;
}

/* Responsive */
@media (max-width: 1200px) {
    .stepper {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
    }

    .step-connector {
        display: none;
    }
}

@media (max-width: 768px) {
    .view-header {
        flex-direction: column;
        gap: 16px;
    }

    .project-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .upload-cards {
        grid-template-columns: 1fr;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .project-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .project-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .tab-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .tab-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* Project Card Menu */
.project-card {
    position: relative;
}

.project-card-menu {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.project-card-menu-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 20px;
    color: var(--gray-400);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.project-card-menu-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.project-card-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    display: none;
    overflow: hidden;
    z-index: 1000;
}

.project-card-menu-dropdown.active {
    display: block;
}

.project-card-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease;
    border: none;
}

.project-card-menu-item:first-child {
    border-radius: 6px 6px 0 0;
}

.project-card-menu-item:last-child {
    border-radius: 0 0 6px 6px;
}

.project-card-menu-item:hover {
    background: var(--gray-50);
}

.project-card-menu-item.danger {
    color: var(--danger);
}

.project-card-menu-item.danger:hover {
    background: var(--danger-light);
}

.project-card-menu-item svg {
    flex-shrink: 0;
}

/* Progress Bar */
.progress-container {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-600);
    text-align: center;
}

/* Transcript Preview Styles */
.transcript-sample-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 16px;
    max-height: 250px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.6;
}

.transcript-sample-box .speaker-line {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.transcript-sample-box .speaker-line:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.transcript-sample-box .speaker-name {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.transcript-sample-box .speaker-text {
    color: var(--gray-700);
}

.speaker-mapping-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
}

.speaker-mapping-row:last-child {
    margin-bottom: 0;
}

.speaker-mapping-row .speaker-label {
    font-weight: 500;
    min-width: 150px;
    color: var(--gray-800);
}

.speaker-mapping-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
}

/* Questions Preview Styles */
.questions-preview-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
}

.question-preview-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

.question-preview-item:last-child {
    border-bottom: none;
}

.question-preview-item:hover {
    background: var(--gray-50);
}

.question-preview-item input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.question-preview-item .question-content {
    flex: 1;
}

.question-preview-item .question-number {
    font-weight: 600;
    color: var(--primary);
    margin-right: 8px;
}

.question-preview-item .question-text {
    color: var(--gray-800);
    line-height: 1.4;
}

.question-preview-item .question-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--gray-500);
}

.question-preview-item .question-meta .tag {
    display: inline-block;
    padding: 2px 6px;
    background: var(--gray-100);
    border-radius: 4px;
    margin-right: 6px;
}

.question-preview-item .question-meta .tag.quantifiable {
    background: var(--blue-100);
    color: var(--blue-700);
}

.question-preview-item.deselected {
    opacity: 0.5;
    background: var(--gray-50);
}

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

/* Roster Preview Styles */
.roster-mapping-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.roster-mapping-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.roster-mapping-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

.roster-sample-table {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
}

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

.roster-sample-table th,
.roster-sample-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
}

.roster-sample-table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-600);
    position: sticky;
    top: 0;
}

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

/* Answers Review Tab */
.answers-respondent-section {
    margin-bottom: 28px;
}

.answers-respondent-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--gray-800);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    font-size: 14px;
}

.answers-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 400;
}

.answers-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    overflow: hidden;
}

.answers-table thead th {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.answers-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
}

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

.answer-qnum {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-400);
    vertical-align: top;
    white-space: nowrap;
}

.answer-qtext {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--gray-700);
    vertical-align: top;
    line-height: 1.5;
}

.answer-cell {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--gray-900);
    vertical-align: top;
    cursor: pointer;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.answer-cell:hover .answer-display {
    background: var(--primary-light);
    border-radius: 4px;
    margin: -4px;
    padding: 4px;
}

.answer-textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    white-space: pre-wrap;
}

.answer-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.answer-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    justify-content: flex-end;
}

/* ── Due Diligence Grid ── */
.dd-grid-container {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--gray-100);
    border-radius: 8px;
}

.dd-grid-container table {
    border-collapse: collapse;
    min-width: 100%;
}

.dd-grid-container th,
.dd-grid-container td {
    padding: 7px 12px;
    border: 1px solid var(--gray-100);
    font-size: 13px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-grid-container th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    min-width: 90px;
    vertical-align: middle;
}

.dd-grid-container th.dd-th-removable {
    position: sticky;
    top: 0;
    padding-right: 22px;
}

.dd-grid-container td:first-child,
.dd-grid-container th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    font-weight: 600;
    border-right: 2px solid var(--gray-200);
}

.dd-grid-container th:first-child {
    z-index: 3;
}

.dd-cell-contact {
    color: var(--gray-600);
    background: #fafafa;
}

.dd-cell-tracking,
.dd-cell-editable {
    cursor: pointer;
    transition: background 0.1s;
}

.dd-cell-tracking:hover,
.dd-cell-editable:hover {
    background: #eff6ff;
}

.dd-cell-empty {
    background: #fffbeb;
}

.dd-cell-editing {
    padding: 2px !important;
    background: #fff !important;
}

.dd-cell-editing input {
    width: 100%;
    border: 2px solid var(--primary);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.dd-th-tracking {
    background: #eff6ff !important;
    color: #1d4ed8;
}

/* Edit mode indicator */
.dd-edit-mode {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* Column remove button on headers in edit mode */
.dd-col-remove {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.dd-col-remove:hover {
    color: var(--danger);
}

/* DD History styles */
.dd-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dd-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 13px;
    flex-wrap: wrap;
}

.dd-history-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.dd-history-who {
    font-weight: 600;
    color: var(--gray-800);
}

.dd-history-field {
    color: var(--gray-500);
    font-size: 12px;
}

.dd-history-when {
    color: var(--gray-400);
    font-size: 11px;
    margin-left: auto;
}

.dd-history-values {
    font-size: 12px;
    color: var(--gray-600);
}

.dd-history-old {
    text-decoration: line-through;
    color: var(--danger);
}

.dd-history-new {
    color: var(--success);
}

/* ── Client Review Question List ── */
.cr-summary-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cr-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.cr-pill:hover {
    opacity: 0.85;
}

.cr-pill-count {
    font-weight: 700;
}

.cr-pill-nochanges {
    background: var(--success-light);
    color: #047857;
}

.cr-pill-changed {
    background: #fef3c7;
    color: #92400e;
}

.cr-pill-notes {
    background: #dbeafe;
    color: #1d4ed8;
}

.cr-pill-excluded {
    background: var(--danger-light);
    color: #b91c1c;
}

.cr-pill-custom {
    background: #ede9fe;
    color: #6d28d9;
}

.cr-pill-total {
    background: var(--gray-100);
    color: var(--gray-600);
}

.cr-question-item {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: all 0.15s;
}

.cr-question-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
}

.cr-qnum {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-400);
    min-width: 36px;
    padding-top: 1px;
}

.cr-qtext {
    flex: 1;
    font-size: 13px;
    color: var(--gray-800);
    line-height: 1.5;
}

.cr-tags {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cr-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 4px;
}

.cr-tag-changed {
    background: #fef3c7;
    color: #92400e;
}

.cr-tag-note {
    background: #dbeafe;
    color: #1d4ed8;
}

.cr-tag-excluded {
    background: var(--danger-light);
    color: #b91c1c;
}

.cr-tag-custom {
    background: #ede9fe;
    color: #6d28d9;
}

.cr-question-item.cr-has-change {
    border-left: 3px solid #f59e0b;
}

.cr-question-item.cr-has-note {
    border-left: 3px solid #2563eb;
}

.cr-question-item.cr-has-change.cr-has-note {
    border-left: 3px solid #f59e0b;
}

.cr-question-item.cr-is-excluded {
    border-left: 3px solid #ef4444;
    opacity: 0.75;
}

.cr-question-item.cr-is-custom {
    border-left: 3px solid #7c3aed;
}

.cr-detail {
    padding: 0 14px 10px 62px;
    font-size: 12px;
}

.cr-diff {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.cr-diff-old {
    background: #fef2f2;
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--gray-700);
    line-height: 1.4;
}

.cr-diff-new {
    background: #f0fdf4;
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--gray-700);
    line-height: 1.4;
}

.cr-diff-label {
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 3px;
}

.cr-note-box {
    background: #eff6ff;
    border-radius: 4px;
    padding: 6px 8px;
    color: #1e40af;
    font-style: italic;
    line-height: 1.4;
}

.cr-tag-user {
    background: #f3e8ff;
    color: #7c3aed;
    font-size: 10px;
}

.cr-contributors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.cr-contributor-pill {
    background: #f8fafc;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
}

.cr-contributor-pill:hover {
    background: #f3e8ff;
    border-color: #c4b5fd;
}

/* DD Import Modal Mapping */
.dd-mapping-table {
    display: grid;
    gap: 6px;
}

.dd-mapping-row {
    display: grid;
    grid-template-columns: 180px 1fr 100px 120px;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--gray-50);
    font-size: 13px;
}

.dd-mapping-row .col-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-mapping-row .col-sample {
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-mapping-row select {
    padding: 4px 6px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
}
