/* ===== CARDS ===== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.card-title i {
    color: var(--primary);
    transition: transform var(--transition-bounce);
}

.card:hover .card-title i {
    transform: scale(1.15) rotate(-5deg);
}

.card-body {
    color: var(--text-secondary);
}

/* ===== RADIO PILLS ===== */
.radio-pill {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--text-sm);
    user-select: none;
}
.radio-pill input[type="radio"] { display: none; }
.radio-pill span {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}
.radio-pill:hover span {
    border-color: var(--border-hover);
}
.radio-pill input[type="radio"]:checked + span {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

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

/* Primary Button */
.btn-primary,
.btn {
    background: var(--primary);
    color: white;
}

.btn-primary:hover,
.btn:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active,
.btn:active {
    transform: scale(0.98);
}

/* Secondary Button */
.btn-secondary,
.btn-sm {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
}

.btn.btn-secondary:hover,
.btn.btn-sm:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

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

/* Ghost Button */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: var(--space-2);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Size Variants */
.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
}

.btn-icon {
    padding: var(--space-2);
    width: 36px;
    height: 36px;
}

/* ===== FORM INPUTS ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--border-hover);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}

/* Input with icon */
.input-group {
    position: relative;
}

.input-group input {
    padding-left: var(--space-10);
}

.input-group i {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Checkbox */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
}

.badge-green,
.badge-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: var(--success-border);
}

.badge-red,
.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger-border);
}

.badge-yellow,
.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: var(--warning-border);
}

.badge-purple {
    background: rgba(168, 85, 247, 0.12);
    color: var(--purple);
    border-color: rgba(168, 85, 247, 0.25);
}

.badge-blue,
.badge-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: var(--info-border);
}

.badge-gray {
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    border-color: var(--border);
}

.badge-pink,
.badge-primary {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid rgba(255, 0, 85, 0.3);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-surface-2);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.tab {
    flex: 1;
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

/* ===== TIMELINE / STEPS ===== */
.timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    margin-bottom: var(--space-6);
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    position: relative;
}

.timeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.timeline-step.completed:not(:last-child)::after {
    background: var(--success);
}

.timeline-step.active:not(:last-child)::after {
    background: linear-gradient(90deg, var(--primary) 50%, var(--border) 50%);
}

.timeline-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-surface-2);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
    position: relative;
    z-index: 1;
    transition: all var(--transition-base);
}

.timeline-step.active .timeline-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
    animation: pulse 2s infinite;
}

.timeline-step.completed .timeline-dot {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.timeline-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
    max-width: 80px;
    line-height: 1.3;
}

.timeline-step.active .timeline-label,
.timeline-step.completed .timeline-label {
    color: var(--text-primary);
}

/* ===== PROGRESS BAR ===== */
.progress-bar-container {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0 var(--space-1);
    margin-bottom: var(--space-4);
}

.progress-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    box-shadow: 0 0 8px var(--primary-glow);
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%
    );
    animation: progressShimmer 2s ease-in-out infinite;
}

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

.progress-bar-text {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 72px;
    text-align: right;
    letter-spacing: 0.02em;
}

/* ===== CATEGORY SCORE CARDS ===== */
.category-scores-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.category-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-3);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.category-low::before { background: var(--success); }
.category-medium::before { background: var(--warning); }
.category-high::before { background: var(--purple); }
.category-critical::before { background: var(--danger); }

.category-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface-2);
}

.category-card:hover::before {
    opacity: 1;
}

.category-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-1);
}

.category-score {
    font-size: var(--text-3xl);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 2px;
    font-variant-numeric: tabular-nums;
    transition: color var(--transition-base);
}

.category-low .category-score { color: var(--success); }
.category-medium .category-score { color: var(--warning); }
.category-high .category-score { color: var(--purple); }
.category-critical .category-score { color: var(--danger); }

.category-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.category-card .badge {
    font-size: 0.6rem;
    padding: 2px var(--space-2);
}

.category-detail {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.3s ease;
    margin-top: 0;
}

.category-card.expanded .category-detail {
    max-height: 300px;
    opacity: 1;
    margin-top: var(--space-3);
    overflow-y: auto;
}

.category-breakdown {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: var(--space-2);
    font-variant-numeric: tabular-nums;
}

.category-reasoning {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
}

/* ===== PIPELINE LAYOUT (parallel tracks) ===== */
.pipeline-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* --- Pre-processing row (sequential) --- */
.p-pre-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.p-pre-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    opacity: 0.4;
    transition: opacity var(--transition-base);
}

.p-pre-step.is-done { opacity: 0.7; }
.p-pre-step.is-active { opacity: 1; }

.p-pre-node {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    background: var(--bg-surface);
    font-size: 0.6rem;
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.p-pre-step.is-done .p-pre-node {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

.p-pre-step.is-active .p-pre-node {
    border-color: var(--warning);
    background: var(--warning-soft);
    color: var(--warning);
    animation: pulseAmber 2s ease-in-out infinite;
}

.p-pre-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

.p-pre-step.is-active .p-pre-label { color: var(--text-primary); }
.p-pre-step:not(.is-done):not(.is-active) .p-pre-label { color: var(--text-disabled); }

.p-pre-arrow {
    color: var(--text-disabled);
    font-size: 0.6rem;
    margin: 0 var(--space-1);
}

/* --- Shared node styles --- */
@keyframes pulseAmber {
    0%, 100% { box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.25); }
    50% { box-shadow: 0 0 8px 3px rgba(234, 179, 8, 0.12); }
}

.p-node-spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(234, 179, 8, 0.3);
    border-top-color: var(--warning);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.p-node-spinner--primary {
    border-color: rgba(255, 0, 85, 0.3);
    border-top-color: var(--primary);
}

.p-node-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-disabled);
}

/* --- Parallel tracks container --- */
.p-tracks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.p-track {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.p-track-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-1);
}

/* --- Track step (inside each track) --- */
.p-track-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    opacity: 0.75;
    transition: opacity var(--transition-base);
}

.p-track-step.is-done { opacity: 0.85; }
.p-track-step.is-active { opacity: 1; }
.p-track-step.is-failed { opacity: 0.9; }
.p-track-step.is-failed .p-track-node {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
}
.p-track-step.is-failed .p-track-label { color: var(--danger); }

.p-track-node {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    background: var(--bg-body);
    font-size: 0.55rem;
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.p-track-step.is-done .p-track-node {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

.p-track-step.is-active .p-track-node {
    border-color: var(--warning);
    background: var(--warning-soft);
    color: var(--warning);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.3);
    animation: pulseAmber 2s ease-in-out infinite;
}

.p-track-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.p-track-step:not(.is-done):not(.is-active) .p-track-label { color: var(--text-disabled); }
.p-track-step.is-done .p-track-label { color: var(--text-secondary); }

.p-elapsed {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

/* --- Sub-progress (STEM_EXTRACTION) --- */
.p-sub-progress {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
}

.p-sub-track {
    width: 60px;
    height: 3px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.p-sub-fill {
    height: 100%;
    background: var(--warning);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.p-sub-text {
    font-size: 0.65rem;
    color: var(--warning);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* --- Final step (Compliance Check) --- */
.p-final-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    opacity: 0.4;
    transition: all var(--transition-base);
}

.p-final-step.is-active {
    opacity: 1;
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: var(--shadow-glow);
}

.p-final-step.is-active .p-track-node {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    animation: pulsePrimary 2s ease-in-out infinite;
}

.p-final-step.is-done {
    opacity: 1;
    border-color: var(--success);
    background: var(--success-soft);
}

.p-final-step.is-done .p-track-node {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

@keyframes pulsePrimary {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 0, 85, 0.25); }
    50% { box-shadow: 0 0 12px 4px rgba(255, 0, 85, 0.12); }
}

.p-final-label {
    font-size: var(--text-sm);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.p-final-step.is-active .p-final-label { color: var(--primary); }
.p-final-step.is-done .p-final-label { color: var(--success); }
.p-final-step:not(.is-done):not(.is-active) .p-final-label { color: var(--text-disabled); }

/* --- Responsive --- */
@media (max-width: 640px) {
    .p-tracks {
        grid-template-columns: 1fr;
    }
    .p-pre-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .p-pre-arrow {
        transform: rotate(90deg);
    }
}

/* ===== CONSOLE ===== */
.console-card {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.console-header {
    background: var(--bg-surface);
    padding: var(--space-3) var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.console-header span {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.console-body {
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    height: 300px;
    overflow-y: auto;
    line-height: 1.7;
}

.console-body div {
    padding: var(--space-1) 0;
    border-bottom: 1px solid var(--border);
}

.console-body div:last-child {
    border-bottom: none;
}

/* ===== META LIST ===== */
.meta-list {
    list-style: none;
}

.meta-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
}

.meta-list li:last-child {
    border-bottom: none;
}

.meta-label {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.meta-val {
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ===== INFO BOX ===== */
.info-box {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.info-box h4 {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.info-box p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* ===== STAT CARDS ===== */
.stat-card {
    flex: 1;
    min-width: 180px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.stat-card:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--purple));
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
}

/* ===== MUSIC BOX ===== */
.music-detected-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background: var(--success-soft);
    border: 1px solid var(--success-border);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    gap: var(--space-4);
}

.music-icon {
    width: 44px;
    height: 44px;
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
}

.music-info {
    flex: 1;
}

.music-title {
    font-weight: 700;
    color: var(--success);
    font-size: var(--text-base);
}

.music-artist {
    font-size: var(--text-sm);
    color: var(--success);
    opacity: 0.8;
}

.music-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ===== WARNING BOX ===== */
.warning-box {
    padding: var(--space-4);
    background: var(--warning-soft);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-lg);
    color: var(--warning);
    font-size: var(--text-sm);
}

/* ===== DARK TABLE ===== */
.dark-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.dark-table thead tr {
    background: var(--bg-surface-2);
}

.dark-table th,
.dark-table td {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.dark-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--text-xs);
    letter-spacing: 0.05em;
}

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

/* ===== TRANSCRIPT BOX ===== */
.transcript-box {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary-soft);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-primary);
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.8;
}

/* ===== FRAME GRID ===== */
.frame-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
}

.frame-thumb {
    cursor: pointer;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.frame-thumb:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.frame-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.frame-thumb:hover img {
    transform: scale(1.1);
}

.frame-more {
    cursor: pointer;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.frame-more:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== SOCIAL BUTTONS ===== */
.social-btn {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: none;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.social-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.social-btn.spotify { background: #1DB954; }
.social-btn.deezer { background: linear-gradient(90deg, #FEAA2D, #EF3054, #A62DA2, #24298E); }
.social-btn.youtube { background: #FF0000; }

/* ===== MODAL ===== */
.modal-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp var(--transition-slow);
}

.modal-header {
    background: var(--bg-body);
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: var(--space-1);
    transition: color var(--transition-fast);
}

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

.modal-body {
    padding: var(--space-6);
    max-height: 70vh;
    overflow-y: auto;
}

/* Modal Sections */
.modal-section {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.modal-section:last-child {
    border-bottom: none;
}

.modal-section-header {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.modal-section-header i {
    color: var(--primary);
}

.modal-section .meta-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* ===== GALLERY ===== */
.gallery-overlay {
    display: flex;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.gallery-card {
    background: var(--bg-surface);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp var(--transition-slow);
}

.gallery-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-body);
}

.gallery-title {
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.gallery-counter {
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--bg-surface-2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-weight: 600;
}

.gallery-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}

.gallery-close-btn:hover {
    color: var(--primary);
}

.gallery-body {
    flex: 1;
    position: relative;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    overflow: hidden;
}

.gallery-image {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--text-lg);
    transition: all var(--transition-base);
    z-index: 10;
}

.gallery-nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev { left: var(--space-5); }
.gallery-next { right: var(--space-5); }

/* ===== DETAILS/ACCORDION ===== */
details {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

details summary {
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 600;
    padding: var(--space-4);
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: background var(--transition-fast);
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: "\f054";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: var(--text-xs);
    transition: transform var(--transition-fast);
}

details[open] summary::before {
    transform: rotate(90deg);
}

details summary:hover {
    background: var(--bg-hover);
}

details > *:not(summary) {
    padding: 0 var(--space-4) var(--space-4);
}

/* ===== FILTER TAGS ===== */
.filter-tag {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    border: 1px solid transparent;
    font-weight: 500;
}

.tag-visual {
    background: var(--info-soft);
    color: var(--info);
    border-color: var(--info-border);
}

.tag-audio {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: rgba(255, 0, 85, 0.3);
}

.filter-tag span {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.6;
    font-size: var(--text-base);
    line-height: 1;
}

.filter-tag span:hover {
    opacity: 1;
    color: var(--danger);
}

/* ===== POLICY CHECKBOX ===== */
.policy-checkbox,
.debug-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    background: var(--bg-surface-2);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.policy-checkbox:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.policy-checkbox:has(input:checked) {
    border-color: var(--border-hover);
    background: var(--bg-surface-3);
}

/* ===== ANALYSIS STEP SELECTION ===== */
.analysis-groups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.analysis-group {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
}

.analysis-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.analysis-group-header span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.analysis-group-header .flex {
    gap: var(--space-1);
}

.analysis-steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

.step-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    background: var(--bg-surface);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.step-checkbox:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.step-checkbox:has(input:checked) {
    border-color: var(--border-hover);
    background: var(--bg-surface-3);
}

.step-checkbox:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

.step-checkbox:has(input:disabled):has(input:checked) {
    opacity: 0.85;
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

/* Single-item groups: let checkbox span full width */
.analysis-steps:has(> :only-child) {
    grid-template-columns: 1fr;
}

.badge.badge-new,
.badge.badge-existing {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
}

.badge.badge-new {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.badge.badge-existing {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid var(--success);
}

/* ===== CONFIG SECTION ===== */
.config-section {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-6);
}

.config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* ===== FILTER RESULTS ===== */
.filter-results {
    display: flex;
    gap: var(--space-8);
    flex-wrap: wrap;
    padding: var(--space-5);
}

.filter-results-group {
    flex: 1;
    min-width: 250px;
}

.filter-results-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-results-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    background: var(--bg-surface-2);
    transition: all var(--transition-base);
}

.filter-result-item:hover {
    background: var(--bg-hover);
}

.filter-result-item.detected {
    background: var(--success-soft);
    border-color: var(--success-border);
    border-left-color: var(--success);
}

.filter-result-item.not-found {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    border-left-color: var(--danger);
}

.filter-term {
    font-weight: 600;
    color: var(--text-primary);
}

.filter-status {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.filter-result-item.detected .filter-status { color: var(--success); }
.filter-result-item.not-found .filter-status { color: var(--danger); }

/* ===== AUDIT CONFIG CARD ===== */
.audit-config-card {
    margin-bottom: var(--space-6);
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-2) 100%);
}

.policy-count {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 0, 85, 0.3);
}

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--text-muted);
    background: var(--bg-surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

/* ===== NOT PERFORMED (skipped analysis) ===== */
.not-performed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8);
    color: var(--text-muted);
    font-size: var(--text-sm);
    background: var(--bg-surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.not-performed i {
    font-size: var(--text-2xl);
    opacity: 0.4;
}

/* ===== TOOLTIP ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-surface-3);
    color: var(--text-primary);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
    white-space: nowrap;
    border: 1px solid var(--border);
    z-index: var(--z-tooltip);
    margin-bottom: var(--space-2);
}

/* ===== AUDIO PLAYER ===== */
audio {
    width: 100%;
    height: 40px;
    margin-top: var(--space-3);
    color-scheme: dark;
}

/* ===== FILTER SECTION ===== */
.filter-section {
    margin-bottom: var(--space-4);
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.filter-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-height: 32px;
}

/* ===== POLICY GRID ===== */
.policy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-2);
}

/* ===== INPUT GROUP ===== */
.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--text-base);
    pointer-events: none;
}

.input-with-icon {
    padding-left: var(--space-10) !important;
}

/* ===== CONSOLE ALIAS ===== */
.console {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ===== SCROLL FADE INDICATOR ===== */
.scroll-fade {
    position: relative;
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Frame grid: 4col -> 2col */
    .frame-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Stat cards: remove min-width, allow 2-up */
    .stat-card {
        min-width: 0;
        flex-basis: calc(50% - var(--space-2));
    }

    /* Tabs: horizontal scroll */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar {
        display: none;
    }
    .tab {
        white-space: nowrap;
        flex: 0 0 auto;
        padding: var(--space-3) var(--space-4);
        min-height: 44px;
    }

    /* Gallery: full-screen on mobile */
    .gallery-card {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .gallery-body {
        min-height: 0;
        flex: 1;
    }
    .gallery-nav-btn {
        width: 40px;
        height: 40px;
    }
    .gallery-prev { left: var(--space-2); }
    .gallery-next { right: var(--space-2); }

    /* Music detected box: stack */
    .music-detected-box {
        flex-direction: column;
        align-items: flex-start;
    }
    .music-actions {
        width: 100%;
        justify-content: flex-start;
    }

    /* Policy grid: smaller minmax */
    .policy-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    /* Filter results: stack */
    .filter-results {
        flex-direction: column;
        gap: var(--space-4);
        padding: var(--space-3);
    }
    .filter-results-group {
        min-width: 0;
    }

    /* Timeline: compact labels */
    .timeline-label {
        font-size: 0.65rem;
        max-width: 60px;
    }

    /* Category cards: keep 2x2 on mobile */
    .category-scores-grid {
        gap: var(--space-2);
    }

    .category-score {
        font-size: var(--text-2xl);
    }

    /* Console body: shorter */
    .console-body {
        height: 200px;
    }

    /* Modal: wider on mobile */
    .modal {
        width: 95%;
        max-width: none;
    }
    .modal-body {
        padding: var(--space-4);
    }

    /* Analysis groups: 1 column on tablet */
    .analysis-groups-grid {
        grid-template-columns: 1fr;
    }

    /* Input + button rows: stack on mobile */
    .input-action-row {
        flex-direction: column;
    }
    .input-action-row .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    /* Card padding reduction */
    .card {
        padding: var(--space-4);
    }
    .card-header {
        padding-bottom: var(--space-3);
        margin-bottom: var(--space-3);
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    /* Stat cards: full width */
    .stat-card {
        flex-basis: 100%;
    }

    /* Info box: less padding */
    .info-box {
        padding: var(--space-3);
    }

    /* Transcript box: shorter */
    .transcript-box {
        max-height: 300px;
    }

    /* Frame grid: tighter gap */
    .frame-grid {
        gap: var(--space-1);
    }

    /* Empty state: less padding */
    .empty-state {
        padding: var(--space-6);
    }

    /* Analysis steps: single column + compact on small screens */
    .analysis-steps {
        grid-template-columns: 1fr;
    }
    .analysis-group {
        padding: var(--space-2);
    }
    .step-checkbox {
        font-size: var(--text-xs);
        padding: var(--space-2);
    }

    /* Meta list: wrap on small screens */
    .meta-list li {
        flex-wrap: wrap;
        gap: var(--space-1);
    }

    /* Score overlay: smaller ring on mobile */
    .score-overlay-ring {
        width: 72px;
        height: 72px;
    }
    .score-overlay-ring::before {
        width: 56px;
        height: 56px;
    }
    .score-overlay-num {
        font-size: var(--text-2xl);
    }
}

/* ===========================================
   Report Page Modernization
   =========================================== */

/* ===== SCORE OVERLAY (on video player) ===== */
.score-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--bg-overlay);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.score-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.score-overlay-ring {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: conic-gradient(var(--score-ring-color) calc(var(--score-pct) * 1%), var(--bg-surface-2) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 30px color-mix(in srgb, var(--score-ring-color) 30%, transparent);
}

.score-overlay-ring::before {
    content: '';
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--bg-overlay);
    position: absolute;
}

.score-overlay-num {
    position: relative;
    font-size: var(--text-3xl);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.score-overlay-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

@keyframes pulseScale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.25); }
}

.score-overlay-dismiss {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: pulseScale 2s ease-in-out infinite 1s;
}

.score-overlay-dismiss:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* ===== COMPACT METADATA SCORES ===== */
.meta-scores-row {
    display: flex;
    gap: var(--space-3);
}

.meta-score-item {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all var(--transition-base);
}

.meta-score-item:hover {
    border-color: var(--border-hover);
}

.meta-score-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.meta-score-num {
    font-size: var(--text-2xl);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.meta-score-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-score-detail {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
    .meta-scores-row {
        flex-direction: column;
    }
}

/* ===== UNDERLINE TABS (report page) ===== */
.tabs--underline {
    background: none;
    padding: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    gap: 0;
}

.tabs--underline .tab {
    border-radius: 0;
    padding: var(--space-3) var(--space-6);
    position: relative;
    background: transparent;
}

.tabs--underline .tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: var(--space-3);
    right: var(--space-3);
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.tabs--underline .tab.active {
    background: transparent;
    color: var(--primary);
    box-shadow: none;
}

.tabs--underline .tab.active::after {
    transform: scaleX(1);
}

.tabs--underline .tab:hover {
    background: transparent;
    color: var(--text-primary);
}

/* ===== STAGGER ENTRANCE ===== */
@keyframes staggerSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-in {
    animation: staggerSlideUp 0.4s ease both;
}

/* ===== AUDIO PLAYER WRAP ===== */
.audio-wrap {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-3);
}

.audio-wrap audio {
    width: 100%;
    height: 40px;
}

.audio-wrap audio::-webkit-media-controls-panel {
    background: transparent;
}

.audio-wrap audio::-webkit-media-controls-current-time-display,
.audio-wrap audio::-webkit-media-controls-time-remaining-display {
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
}

/* ===== SCROLL FADE ===== */
.scroll-fade {
    mask-image: linear-gradient(to bottom, black calc(100% - 40px), transparent);
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 40px), transparent);
}

/* ===== ENGAGEMENT ANALYSIS (v2) ===== */

.eg-tab { display: flex; flex-direction: column; gap: var(--space-6); }

/* ── Hero: Gauge + Metrics ── */
.eg-hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-6);
    align-items: start;
    padding: var(--space-5);
    background: var(--bg-surface-2);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
@media (max-width: 640px) { .eg-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.eg-hero-gauge { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }

/* Animated SVG ring gauge */
.eg-gauge { position: relative; width: 110px; height: 110px; }
.eg-gauge svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.eg-gauge-track { fill: none; stroke: var(--bg-surface-3); stroke-width: 8; }
.eg-gauge-fill {
    fill: none; stroke-width: 8; stroke-linecap: round;
    stroke-dasharray: calc(3.267 * var(--pct)), 326.7;
    transition: stroke-dasharray 1s cubic-bezier(.4,0,.2,1);
}
.eg-gauge--low      .eg-gauge-fill { stroke: var(--success); }
.eg-gauge--medium   .eg-gauge-fill { stroke: var(--warning); }
.eg-gauge--high     .eg-gauge-fill { stroke: var(--purple); }
.eg-gauge--critical .eg-gauge-fill { stroke: var(--danger); }

.eg-gauge-val {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: var(--text-3xl); font-weight: 700; color: var(--text-primary);
}
.eg-gauge-label { font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.eg-gauge-coverage { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; cursor: help; }

.eg-insufficient-banner {
    display: flex; align-items: flex-start; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
    background: var(--warning-soft);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.5;
}
.eg-insufficient-banner i { color: var(--warning); margin-top: 2px; flex-shrink: 0; }

.eg-hero-details { min-width: 0; }
.eg-hero-summary { color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.6; margin-bottom: var(--space-4); }

/* Metric pills */
.eg-metrics { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.eg-metric {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 180px; flex: 1;
}
.eg-metric-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-sm); flex-shrink: 0;
}
.eg-metric-icon.eg-ok   { background: var(--success-soft); color: var(--success); }
.eg-metric-icon.eg-bad  { background: var(--danger-soft);  color: var(--danger); }
.eg-metric-icon.eg-warn { background: var(--warning-soft); color: var(--warning); }
.eg-metric-icon.eg-neutral { background: var(--info-soft); color: var(--info); }

.eg-metric-val { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.eg-metric-explain { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }

/* ── Flags ── */
.eg-flags { display: flex; flex-direction: column; gap: var(--space-2); }
.eg-flag {
    display: flex; align-items: flex-start; gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5;
}
.eg-flag i { color: var(--warning); margin-top: 3px; flex-shrink: 0; }

/* ── Section container ── */
.eg-section {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.eg-section-hdr {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm); font-weight: 600; color: var(--text-primary);
    background: var(--bg-surface);
}
.eg-section-hdr i { color: var(--primary); }

.eg-heuristic-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: var(--space-2);
    padding: 2px var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--warning);
    background: var(--warning-soft);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-full);
    cursor: help;
}
.eg-heuristic-badge i { color: var(--warning) !important; font-size: 10px; }

/* ── Comment Quality ── */
.eg-comments-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5);
    padding: var(--space-4);
}
@media (max-width: 768px) { .eg-comments-grid { grid-template-columns: 1fr; } }
.eg-comment-col { display: flex; flex-direction: column; gap: var(--space-3); }

/* Bot meter */
.eg-bot-meter { margin-bottom: var(--space-2); }
.eg-bot-meter-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.eg-bot-meter-hdr span:first-child { font-size: var(--text-sm); color: var(--text-secondary); }
.eg-bot-meter-pct { font-size: var(--text-lg); font-weight: 700; }
.eg-bot-meter-pct.eg-low      { color: var(--success); }
.eg-bot-meter-pct.eg-medium   { color: var(--warning); }
.eg-bot-meter-pct.eg-high     { color: var(--purple); }
.eg-bot-meter-pct.eg-critical { color: var(--danger); }
.eg-bot-meter-hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-2); }

.eg-bar { height: 10px; background: var(--bg-surface); border-radius: 5px; overflow: hidden; }
.eg-bar-fill { height: 100%; border-radius: 5px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.eg-bar-fill.eg-bar--low      { background: var(--success); }
.eg-bar-fill.eg-bar--medium   { background: var(--warning); }
.eg-bar-fill.eg-bar--high     { background: var(--purple); }
.eg-bar-fill.eg-bar--critical { background: var(--danger); }

/* Sentiment stacked bar */
.eg-sentiment { margin-top: var(--space-2); }
.eg-sentiment-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: var(--space-2); }
.eg-sentiment-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; }
.eg-sentiment-seg { transition: width .6s ease; }
.eg-sentiment-pos { background: var(--success); }
.eg-sentiment-neu { background: var(--text-muted); }
.eg-sentiment-neg { background: var(--danger); }
.eg-sentiment-legend {
    display: flex; gap: var(--space-4); margin-top: var(--space-2);
    font-size: var(--text-xs); color: var(--text-muted);
}
.eg-sentiment-legend i { font-size: 6px; vertical-align: middle; margin-right: 4px; }

/* Bot sample comments */
.eg-bot-samples-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: var(--space-2); }
.eg-bot-samples { display: flex; flex-direction: column; gap: var(--space-1); max-height: 200px; overflow-y: auto; }
.eg-bot-sample {
    padding: var(--space-2) var(--space-3);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5;
    border-left: 2px solid var(--danger-border);
}
.eg-bot-sample i { color: var(--danger); margin-right: var(--space-1); font-size: 10px; }

/* Empty state */
.eg-empty-state {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-5) var(--space-4);
    color: var(--text-muted); font-size: var(--text-sm);
}
.eg-empty-state i { font-size: var(--text-xl); opacity: .5; }

/* ── Channel Performance ── */
.eg-insights {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4) 0;
}
.eg-insight {
    padding: var(--space-3);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.eg-insight-num { font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); }
.eg-insight-num.eg-bad { color: var(--danger); }
.eg-insight-label { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

.eg-chart-wrap {
    padding: var(--space-4);
    height: 360px;
    position: relative;
}

.eg-chart-legend {
    display: flex; gap: var(--space-4); padding: 0 var(--space-4);
    font-size: var(--text-xs); color: var(--text-muted);
}
.eg-section-body { padding: var(--space-4); }
.eg-section-body:first-child { padding-top: 0; }
.eg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* ── AI Content Detection ── */
.eg-ai-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4);
    padding: var(--space-4);
}
@media (max-width: 640px) { .eg-ai-grid { grid-template-columns: 1fr; } }

.eg-ai-card {
    display: flex; flex-direction: column; align-items: center;
    padding: var(--space-5) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: border-color var(--transition-base);
}
.eg-ai-card--low      { border-color: var(--success-border); }
.eg-ai-card--medium   { border-color: var(--warning-border); }
.eg-ai-card--high     { border-color: var(--purple-border); }
.eg-ai-card--critical { border-color: var(--danger-border); }

.eg-ai-card-gauge { position: relative; width: 72px; height: 72px; margin-bottom: var(--space-3); }
.eg-ai-card-gauge svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.eg-ai-track { fill: none; stroke: var(--bg-surface-3); stroke-width: 6; }
.eg-ai-fill {
    fill: none; stroke-width: 6; stroke-linecap: round;
    stroke-dasharray: calc(2.136 * var(--pct)), 213.6;
    transition: stroke-dasharray .8s cubic-bezier(.4,0,.2,1);
}
.eg-ai-card--low      .eg-ai-fill { stroke: var(--success); }
.eg-ai-card--medium   .eg-ai-fill { stroke: var(--warning); }
.eg-ai-card--high     .eg-ai-fill { stroke: var(--purple); }
.eg-ai-card--critical .eg-ai-fill { stroke: var(--danger); }

.eg-ai-card-val {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xl); font-weight: 700;
}
.eg-ai-card--low      .eg-ai-card-val { color: var(--success); }
.eg-ai-card--medium   .eg-ai-card-val { color: var(--warning); }
.eg-ai-card--high     .eg-ai-card-val { color: var(--purple); }
.eg-ai-card--critical .eg-ai-card-val { color: var(--danger); }

.eg-ai-card-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-1); }
.eg-ai-card-desc { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }
