/* Market Intelligence V3 – Cross-Provider Analytics (mv3- prefix) */

/* ── Page Layout ────────────────────────────────────────────────── */
.mv3-page {
    background: #f8fafc;
    min-height: 100vh;
    padding: 1rem;
}

/* ── Header ─────────────────────────────────────────────────────── */
.mv3-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: #ffffff;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.mv3-header-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ── KPI Card Grid ──────────────────────────────────────────────── */
.mv3-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
}

.mv3-kpi-card {
    background: #ffffff;
    border-left: 3px solid #2563eb;
    border-radius: 0.375rem;
    padding: 0.75rem 0.875rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
    min-width: 0;
}

.mv3-kpi-card:hover {
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.12);
}

.mv3-kpi-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e3a5f;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.mv3-kpi-label {
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 0.25rem;
}

.mv3-kpi-change-neutral {
    color: #64748b;
    font-weight: 500;
    font-size: 0.78rem;
}

/* ── Chart Container ────────────────────────────────────────────── */
.mv3-chart-container {
    background: #ffffff;
    border-radius: 0.5rem;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
}

/* ── Controls Bar ───────────────────────────────────────────────── */
.mv3-controls-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

/* ── Section Intro ─────────────────────────────────────────────── */
.mv3-section-intro {
    background: #ffffff;
    border-left: 3px solid #3B82F6;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 0 0.5rem 0.5rem 0;
    font-size: 0.84rem;
    color: #475569;
    line-height: 1.35;
}

.mv3-data-note {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 3px solid #f97316;
    border-radius: 0.375rem;
    color: #9a3412;
    font-size: 0.8rem;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.65rem;
}

.mv3-data-warn {
    color: #b45309;
    border-left-color: #f59e0b;
}

.mv3-data-error {
    color: #b45309;
    border-left-color: #f59e0b;
}

/* ── Info Icon ─────────────────────────────────────────────────── */
.mv3-info-icon {
    display: inline-flex;
    align-items: center;
    cursor: help;
    color: #94a3b8;
    margin-left: 0.25rem;
    font-size: 0.8rem;
}

/* ── Tab Content ────────────────────────────────────────────────── */
.mv3-tab-content {
    padding: 1rem 0;
}


/* ── Index-Divergenz-Hinweis (UC-3, neutral) ─────────────────────── */
.mv3-index-divergence-note {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #64748b;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.75rem;
    color: #334155;
    font-size: 0.875rem;
}

/* ── Signal Badge ───────────────────────────────────────────────── */
.mv3-signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.mv3-signal-contango {
    background: #dbeafe;
    color: #1e40af;
}

.mv3-signal-backwardation {
    background: #fef3c7;
    color: #92400e;
}

.mv3-signal-flat {
    background: #f1f5f9;
    color: #64748b;
}

/* Neutral pill for non-ok curve states (no_selection/no_data/load_failed) */
.mv3-signal-neutral {
    background: #f1f5f9;
    color: #64748b;
}

.mv3-signal-humped {
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mv3-signal-mixed {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ── Freshness Badges ──────────────────────────────────────────── */
.mv3-freshness-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* ── KPI Grid to Chart spacing ─────────────────────────────────── */
.mv3-kpi-grid + .mv3-chart-container {
    margin-top: 0.5rem;
}

/* ── UC-4: Spread Monitor ──────────────────────────────────────── */

/* ── UC-4: Sub-Tab Styling (removed in ISSUE-019, kept for reference)
.mv3-spread-subtabs {
    margin-top: 0.75rem;
}
*/

/* ── UC-4: Spread Separator (ISSUE-019) ──────────────────────── */
.mv3-spread-separator {
    margin-top: 1.25rem;
    margin-bottom: 1rem;
}

/* Spread KPI Cards (warning/healthy states) */
.mv3-spread-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    min-width: 0;
    cursor: default;
}

.mv3-spread-kpi-card:hover {
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.12);
    transform: translateY(-1px);
}

/* Chain Detail Panel */
.mv3-spread-chain-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
}

.mv3-spread-chain-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid #f1f5f9;
}

.mv3-spread-chain-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
}

/* Gap/Missing Data Note */
.mv3-spread-gap-note {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #94a3b8;
    border-radius: 0 0.375rem 0.375rem 0;
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}

/* Data Quality Table */
.mv3-spread-quality-table {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

.mv3-spread-quality-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    color: #475569;
}

.mv3-spread-quality-table th {
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.375rem 0.75rem 0.375rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.mv3-spread-quality-table td {
    padding: 0.375rem 0.75rem 0.375rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.mv3-spread-quality-table tr:last-child td {
    border-bottom: none;
}

/* VPI Caveat Note */
.mv3-spread-caveat {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
    border-radius: 0 0.375rem 0.375rem 0;
    padding: 0.4rem 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.76rem;
    color: #92400e;
    line-height: 1.4;
}

/* Situation Classification Table */
.mv3-spread-situation-table {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.mv3-spread-situation-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.mv3-spread-situation-table th {
    text-align: left;
    font-weight: 600;
    color: #1e3a5f;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.75rem;
}

.mv3-spread-situation-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    line-height: 1.4;
}

.mv3-spread-situation-table tr.mv3-spread-situation-active {
    background: rgba(37, 99, 235, 0.06);
    border-left: 3px solid #2563eb;
}

.mv3-spread-situation-table tr.mv3-spread-situation-active td {
    color: #1e3a5f;
    font-weight: 500;
}

/* Context panel in chain detail */
.mv3-spread-context-item {
    padding: 0.375rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.8rem;
    color: #475569;
}

.mv3-spread-context-item:last-child {
    border-bottom: none;
}

.mv3-spread-context-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mv3-spread-context-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e3a5f;
}

/* Spread-only chains compact section */
.mv3-spread-compact-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
}

.mv3-spread-compact-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.mv3-spread-compact-section th {
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 0.375rem 0.75rem 0.375rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.mv3-spread-compact-section td {
    padding: 0.375rem 0.75rem 0.375rem 0;
    border-bottom: 1px solid #f1f5f9;
}

/* Chain detail compact KPI row */
.mv3-spread-context-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.mv3-spread-context-kpi-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.5rem 0.625rem;
}

/* ── Tier Legend (ISSUE-023) ────────────────────────────────────── */
.mv3-tier-legend {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.mv3-tier-legend summary {
    user-select: none;
}

.mv3-tier-legend summary::-webkit-details-marker {
    color: #94a3b8;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mv3-kpi-grid {
        grid-template-columns: 1fr;
    }
    .mv3-section-intro {
        font-size: 0.825rem;
        padding: 0.625rem 0.875rem;
    }
    .mv3-spread-chain-panel {
        padding: 0.75rem 1rem;
    }
    .mv3-spread-quality-table,
    .mv3-spread-situation-table {
        padding: 0.75rem;
    }
    .mv3-spread-context-kpi-row {
        grid-template-columns: 1fr 1fr;
    }
}
