/* ==========================================================================
   Widget Temps Immortel (Immortal Time Bias)
   ========================================================================== */

.ti-widget {
  --ti-treated-naive: #0284c7;     /* Blue */
  --ti-treated-corr: #16a34a;      /* Green */
  --ti-control: #d97706;           /* Amber */
  --ti-immortal-bg: rgba(239, 68, 68, 0.12);
  --ti-immortal-border: #f87171;
  --ti-border: #e2e8f0;
  --ti-card-bg: #ffffff;
}

/* Header & Subtitle */
.ti-desc {
  color: var(--lca-widget-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: -0.25rem;
  margin-bottom: 0.85rem;
}

/* Faded Methodological Note */
.ti-method-note {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #94a3b8;
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}

.ti-method-note strong {
  color: #475569;
  font-weight: 700;
}

/* Controls Grid */
.ti-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ti-control-card {
  background: #ffffff;
  border: 1px solid var(--ti-border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ti-control-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.ti-control-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  min-height: 2.4rem;
}

.ti-control-badge {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #0f172a;
}

.ti-slider-wrapper {
  margin: 0.5rem 0;
}

.ti-slider {
  width: 100%;
  accent-color: #0284c7;
  cursor: pointer;
}

.ti-slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.ti-control-hint {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.35;
  margin-top: 0.4rem;
  min-height: 2.6rem;
}

/* Status Banner */
.ti-status-banner {
  border-radius: 8px;
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.ti-status-banner--biased {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.ti-status-banner--unbiased {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.ti-status-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ti-status-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.ti-status-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.ti-status-banner--biased .ti-status-title {
  color: #7f1d1d;
}

.ti-status-banner--unbiased .ti-status-title {
  color: #14532d;
}

.ti-status-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
}

.ti-status-banner--biased .ti-status-desc {
  color: #374151;
}

.ti-status-banner--unbiased .ti-status-desc {
  color: #166534;
}

.ti-status-ph-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding: 0.5rem 0.75rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #991b1b;
}

.ti-status-ph-alert-icon {
  flex-shrink: 0;
  line-height: 1.4;
  font-size: 0.95rem;
}

.ti-status-ph-alert-text {
  flex: 1;
  min-width: 0;
}

.ti-status-ph-alert-text strong {
  color: #7f1d1d;
  font-weight: 700;
}

/* Metrics Summary Cards */
.ti-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ti-metric-card {
  background: #ffffff;
  border: 1px solid var(--ti-border);
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ti-metric-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.25rem;
  line-height: 1.25;
  min-height: 2.1rem;
}

.ti-metric-val {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ti-metric-val--miracle {
  color: #dc2626;
}

.ti-metric-val--truth {
  color: #16a34a;
}

.ti-metric-val--neutral {
  color: #0f172a;
}

.ti-metric-sub {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}

/* Graph Container */
.ti-graph-card {
  background: #ffffff;
  border: 1px solid var(--ti-border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.ti-graph-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.ti-graph-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.ti-graph-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.82rem;
}

.ti-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.ti-legend-line {
  display: inline-block;
  width: 1.25rem;
  height: 3px;
  border-radius: 2px;
}

.ti-legend-line--treated-naive {
  background: var(--ti-treated-naive);
}

.ti-legend-line--treated-corr {
  border-top: 2px dashed var(--ti-treated-corr);
  height: 0;
  width: 1.25rem;
}

.ti-legend-line--control {
  background: var(--ti-control);
}

.ti-legend-rect--immortal {
  display: inline-block;
  width: 0.9rem;
  height: 0.7rem;
  background: var(--ti-immortal-bg);
  border: 1px dashed var(--ti-immortal-border);
  border-radius: 2px;
}

.ti-svg-wrapper {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 280px;
}

.ti-svg-wrapper svg {
  display: block;
  width: 100%;
  height: auto;
  user-select: text;
}

/* Insight Box */
.ti-insight-box {
  background: #f8fafc;
  border-left: 4px solid #0284c7;
  border-radius: 0 6px 6px 0;
  padding: 0.9rem 1.1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #334155;
}

.ti-insight-box strong {
  color: #0f172a;
}
