/* Missing Data Lab — Custom Styles */
/* Extends shared/css/main.css */

/* ===================================================
   LAYOUT HELPERS
=================================================== */
.card-section {
    margin-bottom: 0;
}

.card-section > h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--app-text-muted, #64748b);
    margin-bottom: 0.75rem;
}

.section-desc {
    color: var(--app-text-muted, #64748b);
    font-size: 0.93rem;
    margin-top: -0.25rem;
    margin-bottom: 1rem;
    max-width: 720px;
}

/* ===================================================
   MECHANISM EXPLAINER GRID (overview section)
=================================================== */
.mech-explainer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.mech-explainer {
    padding: 1rem 1.1rem;
    border-radius: 8px;
    border-left: 4px solid transparent;
}

.mech-explainer h5 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.mech-explainer p {
    font-size: 0.88rem;
    margin: 0;
    line-height: 1.55;
}

.mech-explainer--mcar {
    background: #f0fdf4;
    border-color: #16a34a;
}
.mech-explainer--mcar h5 { color: #15803d; }

.mech-explainer--mar {
    background: #fffbeb;
    border-color: #d97706;
}
.mech-explainer--mar h5 { color: #b45309; }

.mech-explainer--mnar {
    background: #fef2f2;
    border-color: #dc2626;
}
.mech-explainer--mnar h5 { color: #dc2626; }

/* Treatment tiers table */
.tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
}
.tier-0 { background: #94a3b8; }
.tier-1 { background: #3b82f6; }
.tier-2 { background: #f59e0b; }
.tier-3 { background: #8b5cf6; }

/* ===================================================
   SCENARIO CARDS (Step 1)
=================================================== */
.scenario-select-section {
    margin-bottom: 0;
}

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

.scenario-card {
    background: var(--app-card-bg, #fff);
    border: 2px solid var(--app-border, #e2e8f0);
    border-radius: 12px;
    padding: 1.2rem 1.1rem 1rem;
    cursor: pointer;
    position: relative;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
    user-select: none;
}

.scenario-card:hover {
    border-color: var(--app-accent, #3b82f6);
    box-shadow: 0 4px 14px rgba(59,130,246,0.13);
    transform: translateY(-2px);
}

.scenario-card--active {
    border-color: var(--app-accent, #3b82f6);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.scenario-card__mech {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.mech-mcar { background: #dcfce7; color: #15803d; }
.mech-mar  { background: #fef3c7; color: #92400e; }
.mech-mnar { background: #fee2e2; color: #b91c1c; }

.scenario-card__icon {
    font-size: 1.9rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.scenario-card__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    line-height: 1.3;
}

.scenario-card__cols {
    font-size: 0.8rem;
    color: var(--app-text-muted, #64748b);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.scenario-card__desc {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--app-text, #1e293b);
    margin: 0 0 0.6rem;
}

.scenario-card__tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 0.18rem 0.5rem;
}

.scenario-card__tag--danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* ===================================================
   SETTINGS SECTION (Step 2)
=================================================== */
.scenario-context-strip {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--app-border, #e2e8f0);
    flex-wrap: wrap;
}

.mech-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    border: 1.5px solid;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.mech-badge--mcar  { background: #f0fdf4; border-color: #16a34a; color: #15803d; }
.mech-badge--mar   { background: #fffbeb; border-color: #d97706; color: #92400e; }
.mech-badge--mnar  { background: #fef2f2; border-color: #dc2626; color: #dc2626; }

.scenario-context-text {
    font-size: 0.9rem;
    color: var(--app-text, #1e293b);
    line-height: 1.55;
}

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

@media (max-width: 640px) {
    .settings-grid { grid-template-columns: 1fr; }
}

.control-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--app-text, #1e293b);
    margin-bottom: 0.5rem;
}

.seed-hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--app-text-muted, #64748b);
    display: block;
    margin-top: 0.1rem;
}

.pct-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pct-pill {
    padding: 0.35rem 0.75rem;
    border: 1.5px solid var(--app-border, #e2e8f0);
    border-radius: 20px;
    background: var(--app-card-bg, #fff);
    color: var(--app-text, #1e293b);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.pct-pill:hover {
    border-color: var(--app-accent, #3b82f6);
    background: #eff6ff;
    color: var(--app-accent, #3b82f6);
}

.pct-pill--active {
    background: var(--app-accent, #3b82f6);
    border-color: var(--app-accent, #3b82f6);
    color: #fff;
    box-shadow: 0 1px 4px rgba(59,130,246,0.3);
}

.seed-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.seed-input {
    width: 100px;
    padding: 0.45rem 0.65rem;
    border: 1.5px solid var(--app-border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: monospace;
    background: var(--app-card-bg, #fff);
    color: var(--app-text, #1e293b);
}

.seed-rnd-btn {
    white-space: nowrap;
    font-size: 0.85rem;
}

.inject-actions {
    display: flex;
    gap: 0.75rem;
}

.inject-btn {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.65rem 2rem;
    letter-spacing: 0.01em;
}

/* ===================================================
   WOUND SECTION (Step 3)
=================================================== */
.wound-stats-strip {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.wound-stat {
    flex: 1;
    min-width: 100px;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.wound-stat--red  { background: #fef2f2; border: 1px solid #fecaca; }
.wound-stat--blue { background: #eff6ff; border: 1px solid #bfdbfe; }

.wound-stat__value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}
.wound-stat--red  .wound-stat__value { color: #dc2626; }
.wound-stat--blue .wound-stat__value { color: #2563eb; }

.wound-stat__label {
    font-size: 0.75rem;
    color: var(--app-text-muted, #64748b);
    font-weight: 500;
}

.listwise-warning {
    font-size: 0.88rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    padding: 0.65rem 0.9rem;
    border-radius: 6px;
    color: #78350f;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.chart-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

/* ===================================================
   PLOT CONTAINERS
=================================================== */
.plot-container {
    width: 100%;
    min-height: 300px;
    border-radius: 8px;
    overflow: hidden;
}

.plot-container--short {
    min-height: 220px;
}

.plot-container--tall {
    min-height: 380px;
}

/* ===================================================
   METHOD CARDS (Step 4)
=================================================== */
.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.method-card {
    background: var(--app-card-bg, #fff);
    border: 2px solid var(--app-border, #e2e8f0);
    border-radius: 10px;
    padding: 1.1rem 1rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    user-select: none;
}

.method-card:hover {
    border-color: var(--app-accent, #3b82f6);
    box-shadow: 0 3px 10px rgba(59,130,246,0.12);
    transform: translateY(-1px);
}

.method-card--active {
    border-color: var(--app-accent, #3b82f6);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.method-card__tier {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    color: #fff;
    letter-spacing: 0.06em;
}

.tier-0-bg { background: #94a3b8; }
.tier-1-bg { background: #3b82f6; }
.tier-2-bg { background: #f59e0b; }
.tier-3-bg { background: #8b5cf6; }

.method-card__name {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
}

.method-card__desc {
    font-size: 0.83rem;
    color: var(--app-text-muted, #64748b);
    margin: 0 0 0.65rem;
    line-height: 1.5;
}

.method-card__pros-cons {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.method-card__pros-cons li {
    font-size: 0.8rem;
    line-height: 1.45;
}

.method-card__pros-cons li.pro  { color: #15803d; }
.method-card__pros-cons li.con  { color: #dc2626; }

.commit-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* ===================================================
   RESULTS SECTION (Step 5) — Stat cells
=================================================== */
.chosen-method-banner {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding: 0.6rem 0.9rem;
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
    border-radius: 0 6px 6px 0;
    color: var(--app-text, #1e293b);
}

.prelim-stats-box {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    background: #f8fafc;
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 8px;
}

.prelim-stats-box__title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--app-text-muted, #64748b);
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Stat row / cells */
.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.stat-cell {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.5rem 0.75rem;
    background: var(--app-card-bg, #fff);
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 8px;
    min-width: 100px;
}

.stat-cell--highlight {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.stat-cell__label {
    font-size: 0.7rem;
    color: var(--app-text-muted, #64748b);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.stat-cell__value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--app-text, #1e293b);
}

.stat-cell__value.large {
    font-size: 1.2rem;
}

/* NPS bars */
.nps-bars {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.nps-bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
}

.nps-label {
    width: 68px;
    font-weight: 600;
    flex-shrink: 0;
}

.nps-bar-track {
    flex: 1;
    height: 10px;
    background: #f1f5f9;
    border-radius: 5px;
    overflow: hidden;
}

.nps-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
    max-width: 100%;
}

.nps-pct {
    width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--app-text, #1e293b);
}

/* Bias badges */
.bias-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    vertical-align: middle;
    line-height: 1.3;
}

.bias--green  { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.bias--yellow { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.bias--red    { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
/* Step 6 comparison: the size of the bias is the number itself, so no severity colour. */
.bias--neutral { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

/* ===================================================
   REVEAL CARD
=================================================== */
.reveal-card {
    margin-top: 1.25rem;
    border-radius: 12px;
    padding: 1.5rem;
}

.reveal-card--concealed {
    background: #f0f9ff;
    border: 2px dashed #93c5fd;
    text-align: center;
}

.reveal-card__teaser {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 1rem;
}

.reveal-btn {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.7rem 2.2rem;
}

.reveal-card--exposed {
    background: var(--app-card-bg, #fff);
    border: 1px solid var(--app-border, #e2e8f0);
}

.reveal-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--app-text, #1e293b);
}

.reveal-comparison-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}


.reveal-col {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--app-border, #e2e8f0);
}

.reveal-col--truth     { background: #f0fdf4; border-color: #86efac; }
.reveal-col--committed { background: #f8fafc; }

.reveal-col__label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted, #64748b);
    margin-bottom: 0.75rem;
}

.reveal-col--truth .reveal-col__label { color: #15803d; }

.damage-message {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 1rem;
    background: #fff8f1;
    border-left: 4px solid #f59e0b;
}

/* ===================================================
   COMPARE ALL (Step 6)
=================================================== */
.compare-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--app-border, #e2e8f0);
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--app-card-bg, #fff);
}

.compare-table th {
    padding: 0.55rem 0.9rem;
    background: #f8fafc;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-muted, #64748b);
    border-bottom: 1px solid var(--app-border, #e2e8f0);
    white-space: nowrap;
}

.compare-table td {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--app-border, #e2e8f0);
    color: var(--app-text, #1e293b);
    white-space: nowrap;
}

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

.compare-table .gt-row {
    background: #f0fdf4;
}

.compare-table .gt-row td:first-child {
    color: #15803d;
}

.compare-table tbody tr:hover {
    background: #f8fafc;
}

.compare-table .gt-row:hover {
    background: #dcfce7;
}

/* ===================================================
   WALKTHROUGH STEPS (reuse oversampling pattern)
=================================================== */
.walkthrough-steps {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.walkthrough-step {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.step-num {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--app-accent, #3b82f6);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.step-body {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.55;
}

.step-body strong {
    display: block;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.step-body p {
    margin: 0;
    color: var(--app-text-muted, #64748b);
}

.step-what, .step-why, .step-watch {
    margin: 0.2rem 0 0 !important;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--app-text-muted, #64748b);
}
.step-what em, .step-why em, .step-watch em { font-weight: 600; color: var(--app-text, #1e293b); }

/* ===================================================
   DATASET PREVIEW TABLES
=================================================== */
.preview-tables-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
@media (max-width: 750px) {
    .preview-tables-wrap { grid-template-columns: 1fr; }
}

.preview-table-block .chart-label { margin-bottom: 0.4rem; }

.preview-table-container {
    overflow-x: auto;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 6px;
}

.preview-table {
    width: 100%;
    font-size: 0.75rem;
    border-collapse: collapse;
}
.preview-table th {
    background: var(--app-bg-alt, #f1f5f9);
    padding: 4px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--app-border, #e2e8f0);
}
.preview-table td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--app-border-light, #f1f5f9);
}
.preview-table tbody tr:last-child td { border-bottom: none; }

.missing-cell {
    background: #fef2f2;
    color: #dc2626;
    font-weight: 700;
    text-align: center;
}

.missing-cell-note {
    font-size: 0.78rem;
    color: #dc2626;
    font-weight: 400;
}

/* ===================================================
   EQUATION DISPLAY
=================================================== */
.eq-display {
    background: #f8fafc;
    border: 1px solid var(--app-border, #e2e8f0);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.eq-block { display: flex; flex-direction: column; gap: 0.5rem; }

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

.eq-label {
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 160px;
    padding: 2px 8px;
    border-radius: 4px;
}
.eq-label--truth  { background: #dcfce7; color: #16a34a; }
.eq-label--est    { background: #dbeafe; color: #1d4ed8; }

.eq-math { font-size: 0.95rem; }

.eq-note {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
    color: var(--app-text-muted, #64748b);
}

/* ===================================================
   METHOD CARD — WHEN / PROS / CONS
=================================================== */
.method-card__when {
    font-size: 0.80rem;
    color: var(--app-text-muted, #64748b);
    background: var(--app-bg-alt, #f8fafc);
    border-left: 3px solid #3b82f6;
    padding: 0.4rem 0.6rem;
    border-radius: 0 4px 4px 0;
    margin: 0.4rem 0 0.5rem;
    line-height: 1.45;
}
.method-card__when strong { color: var(--app-text, #1e293b); }

/* ===================================================
   METHOD CARD — SCENARIO-SPECIFIC NOTE
=================================================== */
.method-card__scenario-note {
    font-size: 0.80rem;
    line-height: 1.5;
    color: #1e293b;
    background: #fefce8;
    border-left: 3px solid #ca8a04;
    border-radius: 0 4px 4px 0;
    padding: 0.45rem 0.65rem;
    margin-top: 0.5rem;
}
.method-note-label {
    font-weight: 700;
    color: #92400e;
    margin-right: 0.25rem;
}

/* ===================================================
   CHART NOTES (below each chart)
=================================================== */
.chart-note {
    font-size: 0.81rem;
    line-height: 1.55;
    color: var(--app-text-muted, #64748b);
    background: #f8fafc;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 6px;
    padding: 0.55rem 0.8rem;
}
.chart-note strong { color: #1e293b; }

/* ===================================================
   INTERPRETATION AID (compare-all, wound)
=================================================== */
.interpretation-aid {
    background: #f8fafc;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-size: 0.87rem;
    line-height: 1.6;
}
.interpretation-aid h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}
.interpretation-aid ul {
    margin: 0.5rem 0 0.5rem 1.25rem;
    padding: 0;
}
.interpretation-aid li { margin-bottom: 0.25rem; }
.interpretation-aid p  { margin: 0.5rem 0 0; }

/* ===================================================
   TERM DEFINITION (overview section)
=================================================== */
.term-definition {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 0 6px 6px 0;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.term-definition strong { color: #1d4ed8; }

/* ===================================================
   RESPONSIVE ADJUSTMENTS
=================================================== */
@media (max-width: 560px) {
    .scenario-grid { grid-template-columns: 1fr; }
    .method-grid { grid-template-columns: 1fr; }
    .wound-stats-strip { flex-direction: column; }
    .stat-row { flex-direction: column; }
}
