/* Univariate Analyzer App-Specific Styles */

:root {
    --variable-selector-gap: 1rem;
    --stats-table-border-color: var(--app-border);
}

/* Variable Selector Styles */
.variable-selector {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--app-bg-alt);
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
}

.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.selector-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--app-text);
}

.selector-controls {
    display: flex;
    gap: 0.5rem;
}

.selector-controls .secondary.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.variable-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--variable-selector-gap);
    margin-bottom: 1rem;
}

.variable-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.variable-item:hover {
    background-color: var(--app-bg-hover);
    border-color: var(--app-accent);
}

.variable-item input[type="checkbox"] {
    margin-right: 0.75rem;
    cursor: pointer;
    width: 1rem;
    height: 1rem;
}

.variable-item label {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    flex: 1;
    margin: 0;
}

.variable-name {
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 0.25rem;
}

.variable-type-label {
    font-size: 0.85rem;
    color: var(--app-muted);
}

.variable-type-label.continuous {
    color: var(--app-accent);
}

.variable-type-label.categorical {
    color: var(--app-warning);
}

.variable-type-label.overridden {
    font-weight: 600;
    position: relative;
}

.variable-type-label.overridden::after {
    content: ' ✓';
    font-size: 0.7rem;
}

/* Variable Type Container */
.variable-type-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Type Edit Button */
.type-edit-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.15rem 0.3rem;
    border-radius: 0.25rem;
    opacity: 0.5;
    transition: all 0.2s;
}

.variable-item:hover .type-edit-btn {
    opacity: 1;
}

.type-edit-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Type Editor Panel */
.type-editor-panel {
    width: 100%;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--app-border);
    animation: slideDown 0.2s ease;
}

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

.type-editor-content {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
}

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

.type-editor-header strong {
    font-size: 0.95rem;
    color: #1e293b;
}

.type-editor-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 0;
}

.type-editor-close:hover {
    color: #475569;
}

.type-editor-info {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #64748b;
}

.type-editor-info p {
    margin: 0;
}

.type-editor-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.type-option-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
}

.type-option-btn:hover:not([disabled]) {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.type-option-btn.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.type-option-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.type-option-desc {
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
    margin-top: 0.25rem;
}

.type-editor-tip {
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border: 1px solid #fcd34d;
    border-radius: 0.375rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.85rem;
    color: #92400e;
    margin-bottom: 0.75rem;
}

.type-editor-reset {
    text-align: center;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

.reset-type-btn {
    background: none;
    border: 1px solid #e2e8f0;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-type-btn:hover {
    background: white;
    border-color: #94a3b8;
    color: #334155;
}

/* Variable Type Help Section */
.variable-type-help {
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #7dd3fc;
    border-radius: 0.5rem;
    padding: 0;
}

.variable-type-help summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: #0369a1;
    list-style: none;
}

.variable-type-help summary::-webkit-details-marker {
    display: none;
}

.variable-type-help summary::before {
    content: '▶ ';
    font-size: 0.7rem;
    margin-right: 0.5rem;
}

.variable-type-help[open] summary::before {
    content: '▼ ';
}

.variable-type-help-content {
    padding: 0 1rem 1rem 1rem;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
}

.variable-type-help-content p {
    margin: 0 0 1rem 0;
}

.type-help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.type-help-box {
    background: white;
    border-radius: 0.375rem;
    padding: 0.75rem;
    border: 1px solid #bae6fd;
}

.type-help-box h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #0c4a6e;
}

.type-help-box ul {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.85rem;
}

.type-help-box li {
    margin-bottom: 0.25rem;
}

.type-help-example {
    background: white;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 3px solid #0ea5e9;
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .type-help-grid {
        grid-template-columns: 1fr;
    }
    
    .type-editor-options {
        grid-template-columns: 1fr;
    }
}

.data-summary-text {
    font-size: 0.9rem;
    color: var(--app-muted);
    margin-top: 1rem;
}

/* Results Section */
.results-section.hidden {
    display: none;
}

.variable-navigation {
    margin-bottom: 1.5rem;
}

.variable-navigation label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--app-text);
}

.variable-navigation select {
    width: 100%;
    max-width: 300px;
    padding: 0.5rem;
    border: 1px solid var(--app-border);
    border-radius: 0.4rem;
    background-color: var(--app-bg);
    color: var(--app-text);
    font-size: 1rem;
    cursor: pointer;
}

.type-override-controls {
    margin-top: 1rem;
}

.type-override-controls label {
    display: block;
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.type-buttons {
    display: flex;
    gap: 0.5rem;
}

.type-buttons button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--app-border);
    background-color: var(--app-bg);
    color: var(--app-text);
    border-radius: 0.4rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.type-buttons button:hover {
    border-color: var(--app-accent);
    background-color: var(--app-bg-hover);
}

.type-buttons button.active {
    background-color: var(--app-accent);
    color: white;
    border-color: var(--app-accent);
}

/* Variable Display */
.variable-display {
    margin-bottom: 2rem;
}

.display-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.display-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--app-text);
}

#variable-type-badge {
    font-size: 0.85rem;
    padding: 0.3rem 0.8rem;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Statistics Table */
.stats-table-container {
    background-color: var(--app-bg-alt);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
}

.stats-table-container h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text);
}

#stats-table {
    width: 100%;
    border-collapse: collapse;
}

#stats-table th,
#stats-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--stats-table-border-color);
}

#stats-table th {
    background-color: var(--app-bg);
    font-weight: 600;
    color: var(--app-text);
}

#stats-table tr:hover {
    background-color: var(--app-bg);
}

#stats-table td {
    color: var(--app-text);
    font-family: 'Courier New', monospace;
}

/* Visualization Container */
.visualization-container {
    background-color: var(--app-bg-alt);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
}

.viz-controls {
    margin-bottom: 1rem;
}

.viz-toggle {
    display: flex;
    gap: 0.5rem;
}

.viz-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--app-border);
    background-color: var(--app-bg);
    color: var(--app-muted);
    border-radius: 0.4rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.viz-button:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
}

.viz-button.active {
    background-color: var(--app-accent);
    color: white;
    border-color: var(--app-accent);
}

.chart-container {
    min-height: 500px;
    width: 100%;
}

#stats-table {
    font-size: 0.9rem;
}

/* Chart Narrative Explainer */
.chart-narrative {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--app-bg-alt);
    border-left: 4px solid var(--app-accent);
    border-radius: 0.4rem;
    font-size: 0.9rem;
    color: var(--app-text);
    line-height: 1.6;
}

.chart-narrative:empty {
    display: none;
}

/* Chart Interpretation Section */
.chart-interpretation {
    margin-top: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(54, 162, 235, 0.08) 0%, rgba(54, 162, 235, 0.03) 100%);
    border: 1px solid rgba(54, 162, 235, 0.2);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    color: var(--app-text);
    line-height: 1.7;
}

.chart-interpretation strong {
    color: var(--app-accent);
    font-weight: 600;
}

.chart-interpretation p {
    margin: 0.75rem 0;
}

.chart-interpretation p:first-child {
    margin-top: 0;
}

.chart-interpretation p:last-child {
    margin-bottom: 0;
}

/* Chart Type Selector */
.viz-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.viz-header label {
    font-weight: 600;
    color: var(--app-text);
    font-size: 0.95rem;
}

.chart-type-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: 0.4rem;
    background-color: var(--app-bg);
    color: var(--app-text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-type-select:hover {
    border-color: var(--app-accent);
}

.chart-type-select:focus {
    outline: none;
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3px rgba(54, 162, 235, 0.1);
}

/* Stats Explanations Section */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stats-header h4 {
    margin: 0;
}

.help-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    background-color: var(--app-accent);
    color: white;
    border: none;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-toggle:hover {
    background-color: rgba(54, 162, 235, 0.9);
    transform: translateY(-1px);
}

.help-icon {
    font-size: 1.1em;
}

.stats-explanations {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 206, 86, 0.08) 0%, rgba(255, 206, 86, 0.03) 100%);
    border: 1px solid rgba(255, 206, 86, 0.3);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.stats-explanations.hidden {
    display: none;
}

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

.explanation-item {
    padding: 1rem;
    background-color: var(--app-bg);
    border-radius: 0.4rem;
    border: 1px solid var(--app-border);
}

.explanation-item strong {
    display: block;
    font-size: 1rem;
    color: var(--app-accent);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.explanation-item p {
    margin: 0.5rem 0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.explanation-item p strong {
    display: inline;
    font-size: inherit;
    color: var(--app-text);
    font-weight: 600;
    margin-bottom: 0;
}

.explanation-item p:first-of-type {
    margin-top: 0;
}

.explanation-item p:last-child {
    margin-bottom: 0;
}

/* Variable Type Explainer Cards */
.variable-type-explainer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.type-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(54, 162, 235, 0.05) 0%, rgba(54, 162, 235, 0.02) 100%);
    border: 1px solid rgba(54, 162, 235, 0.15);
    border-radius: 0.5rem;
}

.type-card h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--app-accent);
    font-size: 1.1rem;
    font-weight: 700;
}

.type-card p {
    margin: 0.75rem 0;
    line-height: 1.6;
}

.type-card ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.type-card li {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.type-card li strong {
    color: var(--app-accent);
}

/* Help Icons in Details */
.intro-notes summary .help-icon {
    margin-left: 0.5rem;
    font-size: 0.9em;
    color: var(--app-accent);
    cursor: help;
}

/* Missing Data Info */
.missing-data-info {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--app-bg-warning-light);
    border-left: 4px solid var(--app-warning);
    border-radius: 0.4rem;
}

.missing-data-info p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--app-text);
}

/* Categorical Extra Info */
.categorical-extra-info {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--app-bg-alt);
    border-radius: 0.4rem;
}

.categorical-extra-info input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.categorical-extra-info label {
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--app-text);
}

.categorical-extra-info.hidden {
    display: none;
}

/* Summary Tables Section */
.summary-tables-section {
    margin-top: 2rem;
}

.summary-tables-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.summary-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--app-border);
}

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

.summary-tab:hover {
    color: var(--app-accent);
}

.summary-tab.active {
    color: var(--app-accent);
    border-bottom-color: var(--app-accent);
}

.summary-table-content {
    display: none;
}

.summary-table-content.active {
    display: block;
}

.summary-table-content {
    margin-bottom: 1rem;
}

.summary-table-content > div {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.summary-table-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.summary-table-content th,
.summary-table-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--app-border);
}

.summary-table-content th {
    background-color: var(--app-bg-alt);
    font-weight: 600;
    color: var(--app-text);
}

.summary-table-content tr:hover {
    background-color: var(--app-bg-alt);
}

.summary-table-content td {
    color: var(--app-text);
}

.summary-table-content button {
    margin-top: 1rem;
}

/* Dual Panels for APA and Managerial Reports */
.dual-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.dual-panel {
    padding: 1.5rem;
}

.dual-panel h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--app-text);
}

.dual-panel p {
    color: var(--app-text);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .variable-list {
        grid-template-columns: 1fr;
    }

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

    .selector-controls {
        margin-top: 1rem;
    }

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

    .stats-content {
        grid-template-columns: 1fr;
    }

    .summary-nav {
        flex-wrap: wrap;
    }

    .summary-tab {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    .dual-panels {
        grid-template-columns: 1fr;
    }
    
    .explanation-grid {
        grid-template-columns: 1fr;
    }
    
    .variable-type-explainer {
        grid-template-columns: 1fr;
    }
    
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .viz-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-type-select {
        width: 100%;
    }
    
    .quick-start-cards {
        grid-template-columns: 1fr;
    }
    
    .quality-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .normality-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== NEW COMPONENTS ==================== */

/* Quick Start Section */
.quick-start-section {
    margin-bottom: 2rem;
}

.quick-start-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-text);
    margin-bottom: 1rem;
}

.quick-start-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.quick-start-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(54, 162, 235, 0.08) 0%, rgba(54, 162, 235, 0.02) 100%);
    border: 2px solid rgba(54, 162, 235, 0.2);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.quick-start-card:hover {
    border-color: var(--app-accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(54, 162, 235, 0.15);
}

.quick-start-card:focus {
    outline: 3px solid var(--app-accent);
    outline-offset: 2px;
}

.quick-start-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.quick-start-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--app-accent);
}

.quick-start-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--app-muted);
    line-height: 1.5;
}

/* Data Quality Dashboard */
.data-quality-section {
    margin-bottom: 2rem;
}

.data-quality-section.hidden {
    display: none;
}

.quality-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quality-metric {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--app-bg-alt);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.quality-metric:hover {
    border-color: var(--app-accent);
}

.quality-metric.quality-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

.quality-metric.quality-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

.quality-metric.quality-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.quality-icon {
    font-size: 1.5rem;
}

.quality-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.quality-label {
    font-size: 0.85rem;
    color: var(--app-muted);
    font-weight: 500;
}

.quality-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-text);
}

.quality-details {
    margin-top: 1rem;
}

.quality-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--app-accent);
    padding: 0.5rem 0;
}

.quality-table-container {
    margin-top: 1rem;
    overflow-x: auto;
}

.quality-table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.quality-table-container th,
.quality-table-container td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--app-border);
}

.quality-table-container th {
    background-color: var(--app-bg-alt);
    font-weight: 600;
}

/* Normality Testing Section */
.normality-section {
    margin-top: 1.5rem;
}

.normality-section.hidden {
    display: none;
}

.normality-section h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.normality-section .section-intro {
    margin-bottom: 1.5rem;
    color: var(--app-muted);
    font-size: 0.95rem;
}

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

.normality-result h4,
.normality-chart h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text);
}

.normality-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.normality-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.normality-stat .stat-label {
    font-size: 0.85rem;
    color: var(--app-muted);
}

.normality-stat .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-text);
    font-family: 'Courier New', monospace;
}

.normality-verdict {
    padding: 0.75rem;
    border-radius: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.normality-verdict.normal {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border-left: 3px solid #22c55e;
}

.normality-verdict.non-normal {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-left: 3px solid #f59e0b;
}

.qq-chart-container {
    min-height: 300px;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 0.4rem;
}

/* Chart Help Section */
.chart-help {
    margin-top: 1rem;
    background: var(--app-bg-alt);
    border: 1px solid var(--app-border);
    border-radius: 0.4rem;
    padding: 0.75rem 1rem;
}

.chart-help summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--app-accent);
    font-size: 0.95rem;
}

.chart-help-content {
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.chart-help-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.chart-help-content li {
    margin: 0.5rem 0;
}

/* Interpretation Aid Sections */
.interpretation-aid {
    margin: 1.5rem 0;
    background: var(--app-bg-alt);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.interpretation-aid summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--app-accent);
    font-size: 1rem;
    padding: 0.25rem 0;
}

/* Analyzer Button */
#analyze-btn {
    margin-left: 0.5rem;
}

/* Badge Secondary */
.badge--secondary {
    background-color: rgba(100, 116, 139, 0.15);
    color: #475569;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
}

/* Scenario Selector Panel styles are inline in HTML */

/* Full Width Select for Scenarios */
.full-width-select {
    width: 100%;
}

/* ==================== Callout Box Styles ==================== */

/* Blue callout (info/tips) */
.callout-blue {
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    padding: 0.75rem;
    margin: 0.75rem 0;
}

.callout-blue .callout-title {
    margin: 0;
    font-weight: 600;
    color: #1e40af;
}

.callout-blue ul, .callout-blue p {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    font-size: 0.9rem;
}

/* Green callout (success/how-to) */
.callout-green {
    background: #dcfce7;
    border-left: 3px solid #22c55e;
    padding: 0.75rem;
    margin: 0.5rem 0;
}

.callout-green .callout-title {
    margin: 0;
    font-weight: 600;
    color: #166534;
}

.callout-green ul, .callout-green p {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    font-size: 0.9rem;
}

/* Yellow callout (warning/attention) */
.callout-yellow {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 0.75rem;
    margin: 0.5rem 0;
}

.callout-yellow .callout-title {
    margin: 0;
    font-weight: 600;
    color: #92400e;
}

.callout-yellow ul, .callout-yellow p {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    font-size: 0.9rem;
}

/* Scenario Selector Panel */
.scenario-selector-panel {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.scenario-selector-panel label {
    font-weight: 600;
    font-size: 1rem;
    display: block;
    margin-bottom: 0.75rem;
    color: #1e40af;
}

.scenario-selector-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.scenario-selector-row select {
    flex: 1;
    min-width: 250px;
    max-width: 500px;
    font-size: 1rem;
    padding: 0.6rem;
}

.scenario-info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.scenario-info-box h4 {
    margin: 0 0 0.5rem 0;
    color: #334155;
    font-size: 0.95rem;
}

.scenario-info-box p {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
}

/* Footer retrieved text */
.footer-retrieved {
    font-size: 0.85em;
    color: #6b7280;
}

/* Tutorial/Professor Mode styles are handled by shared/css/main.css */

/* ==================== Edit Types Mode Toggle ==================== */
#edit-types-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

#edit-types-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #2563eb;
}

#edit-types-btn.active:hover {
    background: #2563eb;
}

/* Hide per-variable edit buttons by default */
.type-edit-btn {
    display: none;
}

/* Show edit buttons only when edit mode is active */
.variable-selector.edit-mode-active .type-edit-btn {
    display: inline-block;
    opacity: 1;
}

/* Visual indicator that edit mode is on */
.variable-selector.edit-mode-active .variable-list {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px dashed #f59e0b;
    border-radius: 8px;
    padding: 0.75rem;
}

.edit-mode-banner {
    display: none;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #92400e;
    text-align: center;
}

.variable-selector.edit-mode-active .edit-mode-banner {
    display: block;
}

/* ==================== Data Issue Classification Guide ==================== */
.data-issue-guide {
    margin-top: 1.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.data-issue-guide > summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    color: #1e293b;
}

.data-issue-guide > summary:hover {
    background: #f1f5f9;
}

.data-issue-guide[open] > summary {
    border-bottom: 1px solid #e2e8f0;
}

.guide-intro {
    padding: 1.25rem 1.25rem 0;
    color: #475569;
    line-height: 1.7;
    margin: 0;
}

.issue-classification-grid {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
}

.issue-type {
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.issue-expected {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-color: #22c55e;
}

.issue-investigate {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
}

.issue-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #ef4444;
}

.issue-header {
    margin-bottom: 0.75rem;
}

.issue-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.badge-expected { background: #dcfce7; color: #166534; }
.badge-investigate { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }

.issue-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    color: #64748b;
    font-style: italic;
}

.issue-type ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.issue-type li {
    margin-bottom: 0.6rem;
    line-height: 1.6;
    color: #334155;
}

.issue-type li strong {
    color: #1e293b;
}

.issue-type li em {
    color: #64748b;
    font-size: 0.9em;
}

.issue-action {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #475569;
}

.issue-action strong {
    color: #1e293b;
}

/* Dynamic detected issues section */
.detected-issues-container {
    margin: 1rem 1.25rem 1.25rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.detected-issues-container h4 {
    margin: 0 0 1rem 0;
    color: #1e293b;
    font-size: 1rem;
}

.detected-issue-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    align-items: flex-start;
}

.detected-issue-item:last-child {
    margin-bottom: 0;
}

.detected-issue-item.issue-level-expected {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
}

.detected-issue-item.issue-level-investigate {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
}

.detected-issue-item.issue-level-error {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
}

.detected-issue-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.detected-issue-content {
    flex: 1;
}

.detected-issue-variable {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.detected-issue-message {
    color: #475569;
    font-size: 0.9rem;
    margin-top: 0.25rem;
    line-height: 1.5;
}

.detected-issue-hint {
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
    margin-top: 0.35rem;
}


/* ================================================================
   MARKETING INSIGHT PANEL
   ================================================================ */

.marketing-insight-panel {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1.25rem 0;
}

.marketing-insight-panel.hidden { display: none; }

.marketing-insight-panel h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: #0369a1;
}

.insight-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.insight-card {
    background: #fff;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    border-left: 4px solid #93c5fd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.insight-card.insight-benchmark   { border-left-color: #22c55e; }
.insight-card.insight-archetype   { border-left-color: #8b5cf6; }
.insight-card.insight-central-tendency { border-left-color: #f59e0b; }
.insight-card.insight-variability { border-left-color: #3b82f6; }
.insight-card.insight-decision    { border-left-color: #ef4444; background: #fef2f2; }
.insight-card.insight-concentration { border-left-color: #0ea5e9; }
.insight-card.insight-longtail    { border-left-color: #a855f7; }

.insight-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.insight-header strong {
    font-size: 0.95rem;
    color: #1e293b;
}

.insight-icon {
    font-size: 1.1rem;
}

.insight-text {
    margin: 0;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
}

.insight-detail {
    margin: 0.4rem 0 0 0;
    font-size: 0.82rem;
    color: #64748b;
    font-style: italic;
}


/* ================================================================
   MEASUREMENT SCALE INFO
   ================================================================ */

.measurement-scale-info {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.88rem;
}

.measurement-scale-info.hidden { display: none; }

.scale-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.92rem;
    color: #1e293b;
}

.scale-icon { font-size: 1.2rem; }

.scale-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    background: #fff7ed;
    border-left: 3px solid #f59e0b;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    color: #78350f;
    line-height: 1.5;
}

.scale-ops {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.scale-valid {
    color: #166534;
    font-size: 0.83rem;
}

.scale-invalid {
    color: #991b1b;
    font-size: 0.83rem;
}


/* ================================================================
   WHAT-IF SANDBOX
   ================================================================ */

#whatif-sandbox { margin-top: 0.5rem; }

.whatif-placeholder {
    color: #64748b;
    font-style: italic;
    font-size: 0.9rem;
}

.whatif-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.whatif-control-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.35rem;
}

.whatif-buttons,
.whatif-sample-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.whatif-buttons button.active,
.whatif-sample-buttons button.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.whatif-comparison { margin-top: 0.5rem; }

.whatif-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.whatif-table th,
.whatif-table td {
    padding: 0.45rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.whatif-table th {
    background: #f1f5f9;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}

.whatif-table td:first-child { font-weight: 600; color: #334155; }

.whatif-diff {
    font-size: 0.8rem;
    font-weight: 600;
}

.whatif-diff.positive { color: #16a34a; }
.whatif-diff.negative { color: #dc2626; }

.whatif-lesson {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0 6px 6px 0;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.88rem;
    color: #1e40af;
    line-height: 1.6;
}

.whatif-lesson p { margin: 0; }


/* ================================================================
   ANALYSIS SIDEBAR (floating panel)
   ================================================================ */

.analysis-sidebar {
    position: fixed;
    right: 0;
    top: 80px;
    width: 320px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -4px 0 16px rgba(0,0,0,0.08);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-radius: 8px 0 0 8px;
    overflow: hidden;
}

.analysis-sidebar.open {
    transform: translateX(0);
}

.sidebar-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 0.6rem 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.sidebar-tab:hover { color: #3b82f6; }

.sidebar-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.sidebar-panel {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    display: none;
}

.sidebar-panel.active { display: block; }

.sidebar-panel h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: #1e293b;
}

.toggle-sidebar-btn {
    position: fixed;
    right: 16px;
    top: 90px;
    z-index: 101;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(59,130,246,0.35);
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-sidebar-btn:hover {
    background: #2563eb;
    transform: scale(1.08);
}

.analysis-sidebar.open ~ .toggle-sidebar-btn {
    right: 332px;
}


/* ================================================================
   CHECKLIST
   ================================================================ */

.checklist-progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.checklist-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.checklist-progress-text {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
}

.checklist-instruction {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0 0 0.75rem 0;
    padding: 0.5rem 0.65rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #7dd3fc;
    border-radius: 0.375rem;
    line-height: 1.4;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}

.checklist-item:hover { background: #f8fafc; }

.checklist-item.checked {
    opacity: 0.65;
}

.checklist-item.checked .checklist-label {
    text-decoration: line-through;
}

.checklist-item.auto-item {
    cursor: default;
}

.checklist-item.manual-item {
    cursor: pointer;
    border-left: 3px solid transparent;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

.checklist-item.manual-item:hover {
    border-left-color: #3b82f6;
    background: #f0f9ff;
}

.checklist-item input[type="checkbox"] {
    margin-top: 2px;
    accent-color: #3b82f6;
    flex-shrink: 0;
}

.checklist-item-text {
    display: flex;
    flex-direction: column;
}

.checklist-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.manual-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.checklist-detail {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}


/* ================================================================
   CHALLENGE TAB STYLING
   ================================================================ */

.challenge-intro {
    font-size: 0.88rem;
    color: #334155;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}

.challenge-note {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0 0 1rem 0;
    font-style: italic;
}


/* ================================================================
   FINDINGS NOTEPAD
   ================================================================ */

.notepad-placeholder {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.88rem;
}

.notepad-variable label {
    font-size: 0.88rem;
    color: #334155;
    display: block;
    margin-bottom: 0.4rem;
}

.notepad-variable textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
    min-height: 80px;
}

.notepad-variable textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.notepad-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.notepad-all-findings {
    margin-top: 0.75rem;
}

.notepad-all-findings summary {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b82f6;
}

.notepad-findings-list {
    margin-top: 0.5rem;
}

.notepad-finding-item {
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
    border-left: 3px solid #93c5fd;
}

.notepad-finding-item strong {
    color: #1e40af;
    font-size: 0.84rem;
}

.notepad-finding-item p {
    margin: 0.25rem 0 0 0;
    color: #475569;
    line-height: 1.4;
    white-space: pre-line;
}


/* ================================================================
   CHALLENGE MODE
   ================================================================ */

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

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

.challenge-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.challenge-counter {
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
}

.challenge-score {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b82f6;
}

.challenge-exercise {
    position: relative;
}

.challenge-concept-tag {
    display: inline-block;
    background: #ede9fe;
    color: #6d28d9;
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.challenge-exercise h4 {
    margin: 0.25rem 0 0.5rem 0;
    font-size: 1.05rem;
    color: #1e293b;
}

.challenge-scenario {
    background: #f8fafc;
    border-left: 3px solid #94a3b8;
    padding: 0.75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 0.75rem;
}

.challenge-scenario p {
    margin: 0;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
}

.challenge-question {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: #1e293b;
}

.challenge-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.challenge-option {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 0.9rem;
    color: #334155;
    transition: border-color 0.2s, background 0.2s;
    line-height: 1.45;
}

.challenge-option:not(:disabled):hover {
    border-color: #93c5fd;
    background: #f0f9ff;
}

.challenge-option.correct {
    border-color: #22c55e;
    background: #f0fdf4;
}

.challenge-option.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.challenge-option:disabled { cursor: default; opacity: 0.85; }

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    flex-shrink: 0;
    margin-top: 1px;
}

.challenge-option.correct .option-letter { background: #bbf7d0; color: #166534; }
.challenge-option.incorrect .option-letter { background: #fecaca; color: #991b1b; }

.option-text { flex: 1; }

.challenge-feedback {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.challenge-feedback.correct {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.challenge-feedback.incorrect {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.challenge-feedback strong { display: block; margin-bottom: 0.25rem; }
.challenge-feedback p { margin: 0; }


/* ================================================================
   NEXT STEPS SECTION
   ================================================================ */

.next-steps-section { margin-top: 2rem; }
.next-steps-section.hidden { display: none; }

.next-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.next-step-card {
    display: flex;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.next-step-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(59,130,246,0.1);
}

.next-step-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.next-step-body h4 {
    margin: 0 0 0.35rem 0;
    font-size: 0.95rem;
    color: #1e293b;
}

.next-step-body p {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
}

.next-step-tool {
    font-size: 0.78rem;
    color: #64748b;
    font-style: italic;
    display: block;
    margin-bottom: 0.35rem;
}

.next-step-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.next-step-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: #3b82f6;
    text-decoration: none;
    padding: 0.35rem 0.65rem;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.next-step-link:hover { 
    text-decoration: none;
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}


/* ================================================================
   RESPONSIVE — sidebar + new features
   ================================================================ */

@media (max-width: 768px) {
    .analysis-sidebar {
        width: 100%;
        border-radius: 8px 8px 0 0;
        top: auto;
        bottom: 0;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }

    .analysis-sidebar.open ~ .toggle-sidebar-btn {
        right: 16px;
        bottom: calc(50vh + 8px);
        top: auto;
    }

    .toggle-sidebar-btn {
        top: auto;
        bottom: 16px;
    }

    .next-steps-grid {
        grid-template-columns: 1fr;
    }

    .whatif-table { font-size: 0.82rem; }
    .whatif-table th,
    .whatif-table td { padding: 0.35rem 0.4rem; }
}


/* ================================================================
   WHAT-IF SANDBOX CARD (Dedicated container)
   ================================================================ */

.whatif-sandbox-card {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fcd34d;
    border-radius: 0.75rem;
    padding: 0;
    overflow: hidden;
    display: none; /* Hidden by default, shown for continuous variables */
}

.whatif-sandbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
    border-bottom: 1px solid #fcd34d;
}

.whatif-sandbox-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #713f12;
}

.whatif-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.5rem;
    background: #fbbf24;
    color: #78350f;
    border-radius: 999px;
}

.whatif-explainer {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    color: #78350f;
    line-height: 1.6;
    background: rgba(255,255,255,0.4);
    border-bottom: 1px dashed #fcd34d;
}

.whatif-explainer p {
    margin: 0 0 0.75rem 0;
}

.whatif-explainer p:last-of-type {
    margin-bottom: 0.5rem;
}

.whatif-explainer ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
}

.whatif-explainer li {
    margin: 0.35rem 0;
    font-size: 0.85rem;
}

.whatif-sandbox-card .whatif-sandbox {
    margin: 0;
    padding: 1rem 1.25rem;
    background: rgba(255,255,255,0.5);
    border: none;
}

.whatif-sandbox-card .whatif-sandbox summary {
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
}

.whatif-sandbox-card .whatif-sandbox[open] summary {
    margin-bottom: 1rem;
}


/* ================================================================
   UNIFIED TABLE STYLING (for single-variable and summary tables)
   ================================================================ */

/* Base table design system */
.stats-table,
#stats-table table,
.summary-table-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.stats-table th,
.stats-table td,
#stats-table th,
#stats-table td,
.summary-table-content th,
.summary-table-content td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--app-border);
}

.stats-table th,
#stats-table th,
.summary-table-content th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stats-table tr:last-child td,
#stats-table tr:last-child td,
.summary-table-content tr:last-child td {
    border-bottom: none;
}

.stats-table tr:hover,
#stats-table tr:hover,
.summary-table-content tbody tr:hover {
    background: rgba(59, 130, 246, 0.04);
}

.stats-table td,
#stats-table td,
.summary-table-content td {
    color: var(--app-text);
    font-family: 'Courier New', Consolas, monospace;
}

/* Single-variable stats table specific */
#stats-table {
    margin-top: 0.5rem;
}

#stats-table td:first-child {
    font-family: inherit;
    font-weight: 500;
    color: #334155;
    width: 45%;
}


/* ================================================================
   MICRO-CHART VISUALIZATIONS (for stat explanations)
   ================================================================ */

.stat-micro-chart {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 0.5rem;
}

.stat-micro-chart svg {
    flex-shrink: 0;
}

.micro-chart-label {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}

.micro-chart-pair {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.micro-chart-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem;
    background: rgba(59, 130, 246, 0.04);
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: 0.5rem;
    min-width: 90px;
}

.micro-chart-item svg {
    display: block;
}

.micro-chart-caption {
    font-size: 0.7rem;
    color: #64748b;
    text-align: center;
    font-weight: 500;
}

