/* ============================================
   XAU/USD Trading Dashboard — Dark Theme
   Gold-accented, data-dense, professional
   ============================================ */

:root,
[data-theme='dark'] {
    /* Surfaces — deep charcoal */
    --color-bg: #0a0b0f;
    --color-surface: #13151b;
    --color-surface-2: #1a1d24;
    --color-surface-offset: #1e2128;
    --color-border: #2a2d35;
    --color-divider: #222530;

    /* Text */
    --color-text: #e4e6eb;
    --color-text-muted: #8b8f9a;
    --color-text-faint: #5a5e68;

    /* Accent — Gold */
    --color-gold: #d4af37;
    --color-gold-bright: #f0c75e;
    --color-gold-dim: #8a7424;

    /* Trading colors */
    --color-bull: #26a69a;
    --color-bear: #ef5350;
    --color-neutral: #42a5f5;

    /* Fonts */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Type scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Shadows */
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

[data-theme='light'] {
    --color-bg: #f5f5f0;
    --color-surface: #ffffff;
    --color-surface-2: #faf9f5;
    --color-surface-offset: #f0eee8;
    --color-border: #d5d2ca;
    --color-divider: #e0ddd5;
    --color-text: #1a1c20;
    --color-text-muted: #6b6f7a;
    --color-text-faint: #a0a4ae;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100dvh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

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

.logo-text {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-gold);
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
}

.price-value {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums lining-nums;
}

.price-change {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: 500;
    font-variant-numeric: tabular-nums lining-nums;
}

.price-change.positive { color: var(--color-bull); }
.price-change.negative { color: var(--color-bear); }

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.sentiment-badge {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full, 9999px);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

.sentiment-strong-sell {
    background: rgba(239, 83, 80, 0.15);
    color: var(--color-bear);
    border-color: var(--color-bear);
}

.sentiment-sell {
    background: rgba(239, 83, 80, 0.1);
    color: var(--color-bear);
    border-color: rgba(239, 83, 80, 0.5);
}

.sentiment-neutral {
    background: rgba(66, 165, 245, 0.1);
    color: var(--color-neutral);
    border-color: var(--color-neutral);
}

.sentiment-buy {
    background: rgba(38, 166, 154, 0.1);
    color: var(--color-bull);
    border-color: rgba(38, 166, 154, 0.5);
}

.sentiment-strong-buy {
    background: rgba(38, 166, 154, 0.15);
    color: var(--color-bull);
    border-color: var(--color-bull);
}

.last-update {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    font-variant-numeric: tabular-nums;
}

.refresh-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--color-surface-offset);
    color: var(--color-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: var(--color-surface-2);
    color: var(--color-gold);
}

/* Main */
.main {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-3);
}

.kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

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

.kpi-value {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    font-variant-numeric: tabular-nums lining-nums;
    color: var(--color-text);
}

/* Chart Section */
.chart-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

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

.section-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
}

.chart-legend {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

.dot-sma20 { background: #42a5f5; }
.dot-sma50 { background: #ab47bc; }
.dot-bb { background: rgba(212, 175, 55, 0.3); border: 1px solid var(--color-gold-dim); }

.chart-container {
    position: relative;
    height: 360px;
}

.price-chart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: var(--space-4);
    align-items: stretch;
}

.price-chart-main {
    height: 270px;
    min-width: 0;
}

.price-history-rail {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.015);
    padding: var(--space-3);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.price-history-current-label, .price-history-meta {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.price-history-current {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 700;
    margin: 2px 0 6px;
}

.price-history-canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 205px;
}

@media (max-width: 850px) {
    .price-chart-layout { grid-template-columns: 1fr; }
    .price-history-rail { min-height: 240px; }
}

.chart-small {
    height: 200px;
}

.dual-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.sublabel {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
}

/* Pivot Table */
.pivot-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pivot-row {
    display: grid;
    grid-template-columns: 60px 80px 1fr 1fr;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums lining-nums;
    border-radius: var(--radius-sm);
}

.pivot-header-row {
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--color-divider);
    padding-bottom: var(--space-2);
}

.pivot-row:not(.pivot-header-row):nth-child(even) {
    background: var(--color-surface-2);
}

.pivot-row.resistance { color: var(--color-bear); }
.pivot-row.support { color: var(--color-bull); }
.pivot-row.pivot-row-pivot { color: var(--color-gold); font-weight: 600; }

/* Proximity List */
.proximity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.proximity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    border-left: 3px solid transparent;
}

.proximity-item.resistance { border-left-color: var(--color-bear); }
.proximity-item.support { border-left-color: var(--color-bull); }
.proximity-item.pivot { border-left-color: var(--color-gold); }

.proximity-item.testing {
    background: rgba(212, 175, 55, 0.1);
    border-left-color: var(--color-gold);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.proximity-level {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.proximity-info {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}

.proximity-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full, 9999px);
    font-size: var(--text-xs);
    font-weight: 600;
}

.badge-testing { background: var(--color-gold); color: var(--color-bg); }
.badge-near { background: rgba(212, 175, 55, 0.2); color: var(--color-gold); }

.testing-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full, 9999px);
    background: var(--color-gold);
    color: var(--color-bg);
    font-size: var(--text-xs);
    font-weight: 600;
}

.hidden { display: none; }

/* Probability Model */
.prob-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
}

.prob-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.prob-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prob-bar-container {
    display: flex;
    height: 24px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.prob-bar-up {
    background: var(--color-bull);
    transition: width 0.5s ease;
}

.prob-bar-down {
    background: var(--color-bear);
    transition: width 0.5s ease;
}

.prob-stats {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.prob-up-text { color: var(--color-bull); }
.prob-down-text { color: var(--color-bear); }

.prob-range {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    font-variant-numeric: tabular-nums;
}

.prob-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-left: var(--space-4);
    border-left: 1px solid var(--color-divider);
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.info-row span:first-child {
    color: var(--color-text-muted);
}

.info-row span:last-child {
    font-weight: 500;
    font-family: var(--font-mono);
}

/* Risk/Reward Table */
.rr-table-wrapper {
    overflow-x: auto;
}

.rr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.rr-table th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--color-divider);
    white-space: nowrap;
}

.rr-table td {
    padding: var(--space-2) var(--space-3);
    font-variant-numeric: tabular-nums lining-nums;
    font-family: var(--font-mono);
    border-bottom: 1px solid var(--color-divider);
    white-space: nowrap;
}

.rr-table tbody tr:hover {
    background: var(--color-surface-2);
}

.rr-type-short { color: var(--color-bear); font-weight: 600; }
.rr-type-long { color: var(--color-bull); font-weight: 600; }

.rr-favorable-yes {
    color: var(--color-bull);
    font-weight: 600;
}

.rr-favorable-no {
    color: var(--color-text-faint);
}

.rr-best {
    background: rgba(212, 175, 55, 0.05) !important;
    border-left: 3px solid var(--color-gold);
}

/* Alert Config */
.alert-config {
    border-left: 3px solid var(--color-gold);
}

.alert-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
}

.alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-bull);
    animation: pulse 2s ease-in-out infinite;
}

.alert-levels {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.alert-level-chip {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full, 9999px);
    font-size: var(--text-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.alert-level-chip.resistance {
    background: rgba(239, 83, 80, 0.15);
    color: var(--color-bear);
}

.alert-level-chip.support {
    background: rgba(38, 166, 154, 0.15);
    color: var(--color-bull);
}

.alert-note {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    line-height: 1.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: var(--space-4);
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .dual-charts, .grid-2col {
        grid-template-columns: 1fr;
    }
    .prob-grid {
        grid-template-columns: 1fr;
    }
    .prob-info {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--color-divider);
        padding-top: var(--space-3);
    }
}

@media (max-width: 640px) {
    .header-left {
        gap: var(--space-3);
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .main {
        padding: var(--space-3);
    }
}


/* Projection, event risk and analysis readability */
.projection-chart-container { min-height: 430px; }
.projection-summary { color: var(--color-text); font-weight: 700; font-size: var(--text-sm); }
.projection-targets { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:var(--space-3); margin-bottom:var(--space-4); }
.projection-target { padding:var(--space-3); border:1px solid var(--color-border); border-radius:var(--radius-sm); background:var(--color-surface-2); }
.projection-target span { display:block; color:var(--color-text-muted); font-size:var(--text-xs); text-transform:uppercase; }
.projection-target strong { display:block; margin-top:4px; font-family:var(--font-mono); color:var(--color-gold-bright); }
.projection-events { display:grid; gap:var(--space-2); margin-top:var(--space-2); }
.projection-event { display:grid; grid-template-columns:130px minmax(180px,1fr) minmax(220px,1.4fr); gap:var(--space-3); padding:var(--space-3); border-left:4px solid var(--color-gold); border-radius:var(--radius-sm); background:rgba(212,175,55,.10); font-size:var(--text-sm); }
.projection-event.bullish { border-left-color:var(--color-bull); background:rgba(38,166,154,.12); }
.projection-event.bearish { border-left-color:var(--color-bear); background:rgba(239,83,80,.12); }
.projection-event.neutral { border-left-color:var(--color-neutral); background:rgba(66,165,245,.09); }
.projection-disclaimer { color:var(--color-text-faint); font-size:var(--text-xs); line-height:1.5; margin-top:var(--space-3); }
.indicator-row { display:block; margin:7px 0; padding:10px 12px; border-left:4px solid transparent; border-radius:var(--radius-sm); }
.indicator-main { display:grid; grid-template-columns:minmax(130px,1fr) 105px 90px; gap:var(--space-3); align-items:center; }
.ind-name { color:var(--color-text); font-weight:600; }.ind-value { color:var(--color-text-muted); font-family:var(--font-mono); }.indicator-action { text-align:right; font-weight:700; text-transform:uppercase; }.indicator-description { margin:7px 0 0; color:var(--color-text-muted); font-size:var(--text-xs); line-height:1.45; }
.analysis-row-buy { background:rgba(38,166,154,.16); border-left-color:var(--color-bull); }.analysis-row-sell { background:rgba(239,83,80,.16); border-left-color:var(--color-bear); }.analysis-row-neutral { background:rgba(212,175,55,.14); border-left-color:var(--color-gold); }
.word-buy { color:var(--color-bull); font-weight:800; }.word-sell { color:var(--color-bear); font-weight:800; }.word-neutral { color:var(--color-gold); font-weight:800; }
.consensus-heading { display:inline-block; padding:var(--space-2) var(--space-3); border-radius:var(--radius-sm); background:linear-gradient(90deg,rgba(239,83,80,.18),rgba(212,175,55,.16),rgba(38,166,154,.18)); color:var(--color-text) !important; font-weight:700; }
.headline-item { padding:var(--space-3); margin:var(--space-2) 0; border-radius:var(--radius-sm); border-left:4px solid var(--color-gold); }.headline-item.headline-fxempire { background:rgba(239,83,80,.10); border-left-color:var(--color-bear); }.headline-item.headline-investing { background:rgba(66,165,245,.10); border-left-color:var(--color-neutral); }.headline-source { font-weight:800; margin-right:var(--space-2); }.headline-text { color:var(--color-text); }
.community-section { border-top:2px solid var(--color-gold); }.external-source-link { color:var(--color-gold-bright); font-size:var(--text-sm); font-weight:600; }.community-summary { color:var(--color-text-muted); line-height:1.55; margin-bottom:var(--space-3); }.community-post { padding:var(--space-3); margin-top:var(--space-2); border:1px solid var(--color-border); border-radius:var(--radius-sm); background:var(--color-surface-2); }.community-post a { color:var(--color-gold-bright); font-weight:700; }.community-post p,.community-empty { color:var(--color-text-muted); font-size:var(--text-sm); margin-top:var(--space-2); }
@media(max-width:760px){.projection-targets{grid-template-columns:repeat(2,minmax(0,1fr));}.projection-event{grid-template-columns:1fr;gap:var(--space-1);}.indicator-main{grid-template-columns:1fr;gap:4px;}.indicator-action{text-align:left;}}


/* Requested 48h calendar + highlighted market consensus */
.projection-calendar { margin-top: var(--space-4); padding: var(--space-4); border:1px solid var(--color-border); border-radius:var(--radius-md); background:var(--color-surface-2); }
.projection-event-comment { margin-top:var(--space-2); font-size:var(--text-xs); color:var(--color-text-faint); }
.consensus-note { display:inline-block; margin-top:var(--space-2); padding:var(--space-2) var(--space-3); border:1px solid var(--color-gold); border-radius:var(--radius-sm); background:linear-gradient(90deg,rgba(239,83,80,.16),rgba(212,175,55,.14),rgba(38,166,154,.16)); font-family:var(--font-mono); font-weight:700; letter-spacing:.02em; color:var(--color-text); }
.analysis-sentiment-section { border:1px solid var(--color-gold); border-radius:var(--radius-md); padding:var(--space-4); background:rgba(212,175,55,.06); box-shadow:0 0 0 1px rgba(212,175,55,.08), var(--shadow-md); }

.consensus-bear{color:var(--color-bear)} .consensus-neutral{color:var(--color-neutral)} .consensus-bull{color:var(--color-bull)}
.projection-event.high{border-left-color:var(--color-bear);background:rgba(239,83,80,.12)}

/* Final compact layout refinements */
.projection-events-title { font-size: var(--text-xs); margin-bottom: 2px; }
.projection-calendar { margin-top: var(--space-2); padding: var(--space-2) var(--space-3); }
.projection-event { grid-template-columns: 105px minmax(150px,1fr) minmax(170px,1.2fr); gap: var(--space-2); padding: 6px 8px; font-size: 11px; border-left-width: 5px; }
.projection-event.high { box-shadow: 0 0 0 1px rgba(239,83,80,.18), 0 0 12px rgba(239,83,80,.08); }
.analysis-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.analysis-card { min-width:0; }
.analysis-card-body { padding: 8px 10px; }
.analysis-card-header { padding: 7px 10px; }
.analysis-card-footer { padding: 6px 10px; }
.analysis-subsection { margin-bottom: 7px; }
.analysis-sublabel { font-size: 10px; }
.analysis-signal-bar { gap: 4px; font-size: 10px; }
.indicator-row { margin: 3px 0; padding: 6px 8px; }
.indicator-description { display:none; }
.analysis-sentiment-section.compact-consensus { margin-top: 8px; padding: 7px 10px; border:1px solid var(--color-border); box-shadow:none; background:var(--color-surface-2); }
.consensus-note { margin:0; padding: 3px 7px; font-size: 11px; border:0; background:transparent; }
.compact-consensus .sentiment-bar-container { margin-top: 4px; }
.compact-consensus .sentiment-labels { display:none; }
.analysis-pivots-section { margin-top: 10px; }
.pivot-section-description { margin: 2px 0 7px; color:var(--color-text-muted); font-size:10px; line-height:1.35; }
.pivots-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px; }
.pivot-method { padding:8px; }
.pivot-method-description { margin:3px 0 6px; color:var(--color-text-muted); font-size:10px; line-height:1.35; }
@media(max-width:760px){.analysis-grid,.pivots-grid{grid-template-columns:1fr;}.projection-event{grid-template-columns:1fr;gap:2px;}}


/* v4 fixes: grouped alerts + compact latest-news rows */
.alert-levels {
    display: block;
    margin-bottom: var(--space-3);
}
.alert-anchor {
    display: inline-block;
    margin-bottom: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full, 9999px);
    background: var(--color-surface-2);
    color: var(--color-text);
    font-size: var(--text-xs);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.alert-timeframe-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}
.alert-timeframe-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
    margin: 0;
}
.alert-timeframe-label {
    padding: 2px 0;
    color: var(--color-text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: center;
}
.alert-timeframe-levels {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
}
.alert-timeframe-levels .alert-level-chip {
    padding: 3px 9px;
}

.analysis-headlines-section { margin-top: 8px; }
.headlines-list { display: grid; gap: 2px; }
.headline-item {
    padding: 5px 8px;
    margin: 0;
    line-height: 1.25;
    border-left-width: 3px;
}
.headline-source {
    margin-right: 6px;
    font-size: 10px;
}
.headline-text {
    font-size: 11px;
    line-height: 1.25;
}

@media(max-width:760px){
  .alert-timeframe-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:420px){
  .alert-timeframe-grid{grid-template-columns:1fr;}
}


/* v6: compact technical-indicator explanations */
.indicator-guide-card { padding: 10px 12px; }
.indicator-guide summary { cursor:pointer; color:var(--color-gold-bright); font-weight:700; font-size:var(--text-sm); }
.indicator-guide-note { margin:7px 0 9px; color:var(--color-text-muted); font-size:11px; line-height:1.4; }
.indicator-guide-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px 10px; }
.indicator-help { padding:7px 9px; border:1px solid var(--color-border); border-radius:var(--radius-sm); background:var(--color-surface-2); }
.indicator-help strong { display:block; margin-bottom:3px; color:var(--color-text); font-size:11px; }
.indicator-help span { display:block; color:var(--color-text-muted); font-size:10px; line-height:1.35; }
@media(max-width:760px){.indicator-guide-grid{grid-template-columns:1fr;}}


/* v7: OpenRouter Free AI market intelligence */
.ai-market-card { border-color: rgba(212,175,55,.28); }
.ai-topline { display:grid; grid-template-columns:150px 120px minmax(0,1fr); gap:10px; align-items:center; margin-bottom:10px; }
.ai-bias-block,.ai-confidence-block { padding:9px 11px; border:1px solid var(--color-border); border-radius:var(--radius-sm); background:var(--color-surface-2); }
.ai-label { display:block; margin-bottom:3px; color:var(--color-text-muted); font-size:10px; text-transform:uppercase; letter-spacing:.05em; }
.ai-bias { font-size:16px; letter-spacing:.03em; }
.ai-bullish { color:var(--color-bull); }.ai-bearish { color:var(--color-bear); }.ai-neutral { color:var(--color-gold-bright); }
.ai-meta { color:var(--color-text-muted); font-size:10px; line-height:1.35; text-align:right; }
.ai-outlook-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; margin-bottom:9px; }
.ai-outlook { padding:8px 9px; border:1px solid var(--color-border); border-radius:var(--radius-sm); background:var(--color-surface-2); }
.ai-outlook>span { color:var(--color-gold-bright); font-family:var(--font-mono); font-size:10px; font-weight:800; }
.ai-outlook p { margin:4px 0 0; color:var(--color-text); font-size:10px; line-height:1.35; }
.ai-summary { margin:7px 0 9px; padding:9px 11px; border-left:3px solid var(--color-gold); background:rgba(212,175,55,.06); color:var(--color-text); font-size:11px; line-height:1.45; }
.ai-factor-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.ai-factor { padding:8px 10px; border:1px solid var(--color-border); border-radius:var(--radius-sm); background:var(--color-surface-2); }
.ai-factor strong { display:block; margin-bottom:4px; font-size:10px; }
.ai-factor ul { margin:0; padding-left:16px; color:var(--color-text-muted); font-size:10px; line-height:1.35; }
.ai-factor-bull strong { color:var(--color-bull); }.ai-factor-bear strong { color:var(--color-bear); }
.ai-disclaimer { margin:8px 0 0; color:var(--color-text-faint); font-size:9px; line-height:1.35; }
@media(max-width:760px){.ai-topline{grid-template-columns:1fr 1fr}.ai-meta{grid-column:1/-1;text-align:left}.ai-outlook-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ai-factor-grid{grid-template-columns:1fr}}


/* v8: extra AI macro context + forecast track record */
.ai-context-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(148,163,184,.18); }
.ai-macro-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; margin:8px 0 10px; }
.ai-macro-item { padding:9px 10px; border:1px solid rgba(148,163,184,.16); border-radius:8px; background:rgba(15,23,42,.35); min-width:0; }
.ai-macro-item span,.ai-macro-item small { display:block; color:#94a3b8; font-size:11px; }
.ai-macro-item strong { display:block; margin:2px 0; font-size:15px; }
.ai-regime-line,.ai-performance-line { font-size:12px; color:#cbd5e1; margin:5px 0; }
.ai-history-wrap { overflow-x:auto; margin-top:8px; }
.ai-history-table { width:100%; border-collapse:collapse; font-size:11px; }
.ai-history-table th,.ai-history-table td { padding:5px 7px; border-bottom:1px solid rgba(148,163,184,.12); text-align:center; white-space:nowrap; }
.ai-history-table th:first-child,.ai-history-table td:first-child { text-align:left; }
.history-hit { color:#4ade80; font-weight:700; }
.history-miss { color:#f87171; font-weight:700; }
@media (max-width:1100px){ .ai-macro-grid{grid-template-columns:repeat(3,minmax(0,1fr));} }
@media (max-width:650px){ .ai-macro-grid{grid-template-columns:repeat(2,minmax(0,1fr));} }


/* v8d: compact R1/S1 history table */
.r1s1-history-row { grid-template-columns: 1.15fr .9fr .9fr .9fr 1.25fr; }
.r1s1-history-row .resistance { color: var(--bear, #ef5350); font-weight: 600; }
.r1s1-history-row .support { color: var(--bull, #26a69a); font-weight: 600; }
.history-source { font-size: .78rem; opacity: .82; }
.history-exact { opacity: 1; }
.history-reconstructed { opacity: .62; font-style: italic; }
@media (max-width: 760px) {
  .r1s1-history-row { grid-template-columns: 1.25fr .9fr .9fr .9fr; }
  .r1s1-history-row > span:last-child { display:none; }
}

/* v8f - FXEmpire compact analyst forecast */
.fxempire-forecast-box{border-top:1px solid rgba(255,255,255,.06);padding-top:8px;margin-top:5px}
.fxempire-forecast-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 10px}
.fxempire-forecast-grid>div{background:rgba(255,255,255,.025);border:1px solid rgba(255,255,255,.055);border-radius:6px;padding:6px 8px;display:flex;flex-direction:column;gap:2px}
.fxempire-forecast-grid span{font-size:10px;color:var(--color-text-muted,#8b8f9a);text-transform:uppercase;letter-spacing:.03em}
.fxempire-forecast-grid strong{font-size:12px;line-height:1.25;color:var(--color-text,#e4e6eb);font-weight:700}
@media(max-width:700px){.fxempire-forecast-grid{grid-template-columns:1fr}}

/* v8h: compact AI digest for the three newest headlines */
.ai-news-digest {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 10px;
  background: rgba(15,23,42,.28);
}
.ai-news-digest strong { display:block; margin-bottom:5px; font-size:.9rem; }
.ai-news-digest p { margin:0; line-height:1.45; font-size:.9rem; }


/* v8k: unified technical view + projection/current-price 50/50 layout */
.technical-overview-stack{display:grid;gap:10px}
.technical-mini-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.technical-mini-panel{min-width:0;border:1px solid var(--color-border);border-radius:var(--radius-md);background:rgba(255,255,255,.012);padding:7px 9px}
.technical-mini-title{font-size:11px;font-weight:700;color:var(--color-text-secondary);margin-bottom:4px}
.technical-mini-chart{height:145px}
.projection-price-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:var(--space-4);align-items:stretch}
.projection-price-grid .projection-chart-container{height:430px;min-height:430px}
.projection-price-history{height:330px;box-sizing:border-box}
.projection-price-history .price-history-canvas-wrap{min-height:245px}
.fxempire-ma-summary{font-size:11px;font-weight:700;margin:3px 0 6px}
.fxempire-ma-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 7px}
.fxempire-ma-item{display:flex;justify-content:space-between;gap:8px;padding:4px 6px;border:1px solid rgba(148,163,184,.10);border-radius:5px;font-size:10px}
.fxempire-ma-item .buy{color:var(--color-bull)} .fxempire-ma-item .sell{color:var(--color-bear)} .fxempire-ma-item .neutral{color:var(--color-text-muted)}
.fxempire-review-list{display:grid;gap:6px}
.fxempire-review{padding:6px 8px;border-left:3px solid var(--color-gold);background:rgba(212,175,55,.05);border-radius:5px}
.fxempire-review-title{font-size:10px;font-weight:700;line-height:1.3;color:var(--color-text)}
.fxempire-review-meta{font-size:9px;color:var(--color-text-muted);margin-top:2px}
.fxempire-review-summary{font-size:9px;color:var(--color-text-secondary);line-height:1.35;margin-top:3px}
@media(max-width:900px){.projection-price-grid,.technical-mini-grid{grid-template-columns:1fr}.projection-price-history{height:420px}.projection-price-grid .projection-chart-container{height:420px;min-height:420px}}


/* v8l: one combined technical chart; remove redundant RSI/MACD mini-panels */
.combined-technical-chart{height:360px;min-height:360px}
.combined-chart-note{font-size:10px;color:var(--color-text-muted);margin-top:6px;line-height:1.35}

/* v8n clarity upgrades */
.dot-sma20{background:#00d4ff!important}.dot-sma50{background:#ff4fd8!important}.dot-sma100{background:#ffd54a!important}.dot-rsi{background:#7cff6b!important}
.ai-explanation-text{list-style:none;margin:0;padding:0;line-height:1.55;font-size:13px;color:var(--color-text-primary)}
.technical-timeframes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin-top:6px}.tf-signal{border:1px solid var(--color-border);border-radius:7px;padding:7px 8px;display:flex;flex-direction:column;gap:3px;min-width:0}.tf-signal span{font-size:10px;color:var(--color-text-muted)}.tf-signal strong{font-size:12px}.tf-signal.analysis-row-buy strong{color:#26a69a}.tf-signal.analysis-row-sell strong{color:#ef5350}.tf-signal.analysis-row-neutral strong{color:#d4af37}
@media(max-width:640px){.technical-timeframes{grid-template-columns:1fr}}


/* v8s: unified Yahoo / FXEmpire MA comparison */
.ma-compare-section{margin-top:16px;border-top:1px solid var(--border,#2a2d35);padding-top:14px}
.ma-compare-wrap{overflow-x:auto;margin-top:8px}
.ma-compare-table{width:100%;border-collapse:collapse;font-size:.86rem;min-width:720px}
.ma-compare-table th,.ma-compare-table td{padding:8px 10px;border-bottom:1px solid rgba(127,127,127,.18);text-align:right;white-space:nowrap}
.ma-compare-table th:first-child,.ma-compare-table td:first-child{text-align:left}
.ma-compare-table th{color:var(--muted,#9aa0aa);font-weight:600}
.ma-direction-title{margin-top:16px}
.direction-compare-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:8px}
.direction-compare-card{border:1px solid rgba(127,127,127,.18);border-radius:8px;padding:9px;display:grid;grid-template-columns:72px 1fr 1fr;gap:8px;align-items:center}
.direction-compare-card>span{font-weight:600}.direction-compare-card div{display:flex;flex-direction:column;gap:2px}.direction-compare-card small{color:var(--muted,#9aa0aa)}
.ma-compare-note{margin-top:10px;color:var(--muted,#9aa0aa);font-size:.8rem;line-height:1.35}
@media(max-width:900px){.direction-compare-grid{grid-template-columns:1fr}}

/* v8t: split SPOT history into a readable 60-minute zoom + compact 7-day context. */
.projection-price-history{height:430px;}
.projection-price-history .price-history-zoom-wrap{height:235px;min-height:235px;}
.price-history-zoom-label,.price-history-context-label{font-size:11px;color:#9ca3af;margin:6px 0 4px;letter-spacing:.02em;}
.price-history-context-wrap{height:92px;min-height:92px;position:relative;}
@media(max-width:900px){.projection-price-history{height:420px}.projection-price-history .price-history-zoom-wrap{height:225px;min-height:225px}.price-history-context-wrap{height:90px;min-height:90px}}


/* v8v: source-row horizon comparison + Yahoo/FXEmpire visual parity */
.direction-table-wrap{overflow-x:auto;margin-top:8px}
.direction-source-table{width:100%;border-collapse:collapse;min-width:980px;font-size:.82rem}
.direction-source-table th,.direction-source-table td{padding:9px 8px;border-bottom:1px solid rgba(127,127,127,.18);vertical-align:top;text-align:center}
.direction-source-table thead th{color:var(--muted,#9aa0aa);font-weight:600;white-space:nowrap}
.direction-source-table tbody th{position:sticky;left:0;background:var(--color-card,#15171c);text-align:left;z-index:1;min-width:90px}
.direction-source-table{width:100%;border-collapse:collapse;table-layout:fixed;min-width:920px}
.direction-source-table th,.direction-source-table td{padding:9px 8px;border-bottom:1px solid rgba(127,127,127,.18);text-align:center;vertical-align:middle}
.direction-source-table th:first-child,.direction-source-table td:first-child{text-align:left;width:110px}
.direction-cell{display:table-cell;min-width:110px}
.direction-cell-inner{display:flex;flex-direction:column;gap:3px;align-items:center;justify-content:center}
.direction-cell strong{font-size:.84rem}.direction-cell small{font-size:.72rem;color:var(--muted,#9aa0aa);white-space:nowrap}
#fxempire-card .analysis-indicators-list{margin-top:6px}
#fxempire-card .indicator-row{padding:7px 0}

/* v8af: 24h R2/S2 snapshot captured at the last successful AI analysis. */
.ai-24h-range{margin:10px 0;padding:10px 12px;border:1px solid var(--color-border);border-radius:10px;background:rgba(255,255,255,.015)}
.ai-24h-range-title{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-muted);margin-bottom:8px}
.ai-24h-range-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.ai-24h-level{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;background:rgba(255,255,255,.02)}
.ai-24h-level span{font-size:11px;color:var(--color-text-muted)}
.ai-24h-level strong{font-size:16px;font-family:'JetBrains Mono',monospace}
.ai-24h-r2{border-left:3px solid var(--color-bear)} .ai-24h-r2 strong{color:var(--color-bear)}
.ai-24h-s2{border-left:3px solid var(--color-bull)} .ai-24h-s2 strong{color:var(--color-bull)}
.ai-24h-range small{display:block;margin-top:7px;color:var(--color-text-muted);font-size:10px;line-height:1.35}
@media(max-width:700px){.ai-24h-range-grid{grid-template-columns:1fr}}

/* v8al: AI 24h range grouped with Probability Model */
.probability-ai-range{margin:12px 0 0;padding:12px 14px;border:1px solid rgba(212,175,55,.34);background:linear-gradient(180deg,rgba(212,175,55,.075),rgba(255,255,255,.015));box-shadow:inset 0 0 0 1px rgba(212,175,55,.04)}
.probability-ai-range .ai-24h-range-title{color:var(--color-gold-bright);font-weight:800;font-size:11px}
.probability-ai-range .ai-24h-level{background:rgba(10,11,15,.38)}

/* v8an: decision-first / reduced-graph layout */
.decision-driver-strip{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px;margin:0 0 10px}.driver-chip{padding:7px 9px;border:1px solid rgba(148,163,184,.14);border-radius:8px;background:rgba(255,255,255,.018);min-width:0}.driver-chip span,.driver-chip small{display:block;font-size:9px;color:var(--color-text-muted)}.driver-chip strong{display:block;margin:2px 0;font:700 13px var(--font-mono);color:var(--color-text)}
.history-toggle{display:flex;gap:5px;margin:7px 0 5px}.history-toggle-btn{border:1px solid var(--color-border);background:var(--color-surface-2);color:var(--color-text-muted);border-radius:999px;padding:4px 9px;font-size:10px;cursor:pointer}.history-toggle-btn.active{border-color:var(--color-gold);color:var(--color-gold-bright);background:rgba(212,175,55,.08)}
.projection-price-history .price-history-zoom-wrap{height:310px;min-height:310px}.projection-price-history{height:430px}.price-history-context-wrap{display:none!important}.combined-technical-chart{height:315px;min-height:315px}.indicator-guide-card{padding:8px 10px}.indicator-guide summary{font-size:12px}.ai-macro-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.probability-ai-range{margin-top:9px}.prob-grid{gap:9px}
@media(max-width:900px){.decision-driver-strip{grid-template-columns:repeat(3,minmax(0,1fr))}.ai-macro-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.projection-price-history .price-history-zoom-wrap{height:300px;min-height:300px}}
@media(max-width:620px){.decision-driver-strip,.ai-macro-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v8ao: compact extended XAU signal table */
.extended-xau-card{margin-top:10px}.extended-summary{cursor:pointer;font-weight:800;font-size:13px;color:var(--color-text);display:flex;justify-content:space-between;align-items:center;gap:10px}.compact-header{margin-top:7px}.extended-table-wrap{overflow-x:auto;margin-top:8px}.extended-table{width:100%;border-collapse:collapse;min-width:860px;font-size:.78rem}.extended-table th,.extended-table td{padding:8px 9px;border-bottom:1px solid rgba(127,127,127,.16);vertical-align:top;text-align:left}.extended-table th{font-size:.72rem;color:var(--color-text-muted);font-weight:700}.extended-table td:nth-child(3){font-family:var(--font-mono);font-weight:800;white-space:nowrap}.extended-table small{color:var(--color-text-muted)}.sig-pos{color:var(--color-bull)!important}.sig-neg{color:var(--color-bear)!important}.sig-neu{color:var(--color-gold-bright)!important}.fresh-ok{color:var(--color-bull);font-weight:700}.fresh-na{color:var(--color-text-muted);font-weight:700}.extended-note{font-size:10px;color:var(--color-text-muted);line-height:1.4;margin-top:7px}

/* XAU2 compact header / aligned scenario range */
.header{padding:7px 16px;gap:12px;min-height:48px}
.header-left{gap:13px}.header-right{gap:10px;flex-wrap:wrap;justify-content:flex-end}
.header .logo svg{width:23px;height:23px}.header .logo-text{font-size:1rem}
.header .price-value{font-size:1.32rem}.header .price-change{font-size:.84rem}
.header .sentiment-badge{padding:4px 9px;font-size:.72rem}
.header-links{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.header-links a{font-size:.76rem;color:var(--color-gold-bright);text-decoration:none;white-space:nowrap}
.header-links a:hover{text-decoration:underline}
.probability-ai-range{border-color:var(--color-border);background:var(--color-surface-2);box-shadow:none}
.probability-ai-range .ai-24h-range-title{color:var(--color-text-muted);font-weight:650}
.probability-ai-range .ai-24h-range-grid{gap:12px}
.probability-ai-range .ai-24h-level{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-md);padding:10px 12px}
.probability-ai-range .ai-24h-s2{border-left:3px solid var(--color-bear)}
.probability-ai-range .ai-24h-s2 strong{color:var(--color-bear)}
.probability-ai-range .ai-24h-r2{border-left:3px solid var(--color-bull)}
.probability-ai-range .ai-24h-r2 strong{color:var(--color-bull)}
@media(max-width:850px){.header{flex-wrap:wrap}.header-right{width:100%;justify-content:space-between}.header-links{gap:8px}}

/* XAG addition */
.xag-alert{padding:11px 15px;margin:10px 0;background:#1b2630;border:1px solid #657484;border-radius:9px;color:#d2dae2;font-size:13px}
.xag-alert.up{border-color:#26a69a;color:#78d9bb}.xag-alert.down{border-color:#ef5350;color:#ff9997}
.xag-chart-wrap{position:relative;height:315px;width:100%;margin:12px 0}
.xag-table-scroll{width:100%;overflow-x:auto;margin:12px 0}.xag-table{width:100%;border-collapse:collapse;font-size:12px;white-space:nowrap}
.xag-table th,.xag-table td{padding:10px 12px;border-bottom:1px solid #343d4a;text-align:right}
.xag-table th:first-child,.xag-table td:first-child{text-align:left}.xag-table th{color:#bdc5cf}

/* v8au compact panels */
.extended-xau-card details:not([open]){padding:0}
.extended-xau-card .extended-summary{padding:2px 0; font-size:12px}
.extended-table th,.extended-table td{padding:5px 7px;line-height:1.25}
.compact-alerts{padding:9px 13px}
.compact-alerts .compact-alert-summary{cursor:pointer;font-size:13px;font-weight:700}
.compact-alerts details[open] .compact-alert-summary{margin-bottom:8px}
.compact-alerts .section-header{margin-bottom:4px}
.compact-alerts .alert-note{font-size:10px;line-height:1.3}
.context-help{display:inline-block;cursor:help;border-bottom:1px dotted currentColor;font-size:11px;margin-left:5px}
.context-help:focus{outline:2px solid #c0c0c0;border-radius:3px}

/* v8av concise gold/silver panel, probability layout and directional drivers */
.xag-header-quote{display:flex;flex-direction:column;min-width:115px;padding:3px 10px;border-left:1px solid rgba(175,187,205,.25);gap:1px}
.xag-header-quote>span{font-size:10px;color:#c0c0c0;font-weight:700}.xag-header-quote small{font-size:9px;color:var(--color-text-muted);font-weight:400}.xag-header-quote strong{font:700 17px var(--font-mono);color:#d5d8dd}.xag-header-quote strong.stale{color:#d6a35d}
.xag-backtest-compact{margin:15px 0 8px;padding:12px;border:1px solid rgba(158,174,194,.17);border-radius:10px;background:rgba(130,145,164,.025)}
.xag-backtest-compact .section-header{margin-bottom:7px}.xag-backtest-compact h3{font-size:14px}.xag-backtest-compact .sublabel{font-size:10px}
.xag-backtest-compact .xag-alert{padding:7px 10px;font-size:11px}.xag-backtest-compact .xag-table-scroll{margin:6px 0}
.xag-backtest-compact .xag-table th,.xag-backtest-compact .xag-table td{padding:6px 10px;font-size:11px}
.prob-grid{align-items:stretch;gap:12px}.prob-block,.prob-info{border:1px solid rgba(170,185,207,.16);border-radius:10px;padding:13px;background:rgba(255,255,255,.02)}
.prob-info .info-row{padding:7px 0}.prob-label{font-weight:700}.driver-chip{border-radius:10px;min-height:82px;display:flex;flex-direction:column;justify-content:space-between}
.help-dot{display:inline!important;cursor:help;color:#92aec8!important;font-size:12px!important;padding-left:2px}.help-dot:focus{outline:2px solid #d4af37}
.driver-impact{margin-top:3px!important;font-size:10px!important;font-weight:700!important}.driver-impact[data-tone=positive]{color:#4dc99b!important}.driver-impact[data-tone=negative]{color:#ed7c7c!important}.driver-impact[data-tone=neutral]{color:#d2b879!important}
@media(max-width:700px){.header-left{flex-wrap:wrap}.xag-header-quote{border-left:0;border-top:1px solid rgba(175,187,205,.25);padding-left:0}.xag-backtest-compact{padding:8px}}

/* v8aw: merge 24h AI range into the Today XAU directional forecast card. */
.prob-block .probability-ai-range{margin:5px 0 0;padding:10px;border:1px solid rgba(212,175,55,.28);box-shadow:none;flex:1}
.prob-block .probability-ai-range .ai-24h-range-title{font-size:10px;line-height:1.5}
.prob-block .probability-ai-range .ai-24h-range-grid{grid-template-columns:1fr;gap:5px}
.prob-block .probability-ai-range .ai-24h-level{padding:6px 8px}
.prob-block .probability-ai-range .ai-24h-level strong{font-size:13px}
.prob-block .probability-ai-range small{font-size:10px}

/* v8ax: same visual language as today direction bar */
.ai-range-direction-bar{height:11px;display:flex;overflow:hidden;border-radius:999px;margin:8px 0 4px;background:var(--color-border)}
.ai-range-green{background:var(--color-bull);min-width:0}
.ai-range-red{background:var(--color-bear);min-width:0}
.ai-range-legend{display:flex;justify-content:space-between;gap:8px;font-size:11px;color:var(--color-text-muted)}

/* v8ay: match AI range visuals to tomorrow probability strip, while keeping range semantics distinct */
.prob-block .ai-range-direction-bar{height:24px;margin:6px 0 4px;border-radius:var(--radius-sm)}
.prob-block .ai-range-legend{font-size:var(--text-sm);font-weight:650;margin-bottom:4px}
.prob-block .ai-range-legend span:first-child{color:var(--color-bear)}
.prob-block .ai-range-legend span:last-child{color:var(--color-bull)}

/* v8az: same compact expected-range typography as Today direction */
.ai-expected-inline{margin-top:6px;font-variant-numeric:tabular-nums;}

/* v8bk: tomorrow AI outlook as prominent as the 24h AI range */
.ai-tomorrow-highlight{margin-top:12px;padding:12px 13px;border:1px solid rgba(212,175,55,.32);background:rgba(212,175,55,.045);border-radius:10px;display:flex;flex-direction:column;gap:7px;min-height:76px}
.ai-tomorrow-label{font-size:11px;letter-spacing:.05em;text-transform:uppercase;color:var(--color-gold-bright,#dfc67b);font-weight:800}
.ai-tomorrow-highlight strong{font-size:clamp(15px,1.5vw,19px);line-height:1.4;color:var(--color-text,#ebedf0);font-weight:750;overflow-wrap:anywhere}

/* v8bm: short XAG event view and honest XAU spot timestamp */
.xag-ticker-direction{font-size:17px;font-weight:750;margin-bottom:5px;letter-spacing:.01em}
.xag-ticker-line{font-size:13px;line-height:1.6;font-weight:550}
.header-xau-quote-ts{display:block;font-size:10px;line-height:1.35;color:#aab6c3;max-width:190px}

/* v8bn: XAG signal is one visual line, scrollable on narrow screens. */
.xag-ticker-single-line{white-space:nowrap;overflow-x:auto;max-width:100%;font-size:14px;font-weight:650;line-height:1.9;scrollbar-width:thin}

/* v8cg: price-first two-axis chart with optional relative view */
.xag-view-controls{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.xag-view-button{border:1px solid var(--color-border, #59616e);border-radius:7px;padding:7px 12px;color:var(--color-text, #d1d5db);background:transparent;cursor:pointer;font:inherit;font-size:12px}
.xag-view-button.active{border-color:#d4af37;color:#d4af37;background:rgba(212,175,55,.1);font-weight:600}
.xag-view-button:focus-visible{outline:2px solid #d4af37;outline-offset:2px}

/* v8ch: one-line calendar fallback and compact projection caveat */
.projection-calendar{padding:6px 10px;margin-top:7px}
.projection-events-title{margin-bottom:0}
.projection-events{margin-top:3px;gap:3px}
.projection-event.neutral{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;padding:4px 8px;line-height:1.3;border-left-width:3px;font-size:11px}
.projection-event-comment:empty,.projection-event-comment[hidden]{display:none!important}
.projection-disclaimer{margin-top:6px;font-size:11px;line-height:1.4}

/* v8ck: one compact aggregated total below the five latest XAG alerts */
.xag-table tfoot .xag-tracker-total{background:rgba(130,145,165,.12);font-weight:750;border-top:2px solid rgba(160,175,190,.35)}
.xag-table tfoot .xag-tracker-total th{text-align:left;white-space:nowrap}
.xag-table tfoot .xag-tracker-total td{font-variant-numeric:tabular-nums}

/* v8co: compact collapsible news, accessible MA explanations */
.headlines-collapsible{margin-top:8px;border:1px solid rgba(160,175,190,.18);border-radius:8px;padding:0!important;overflow:hidden}
.headlines-collapsible>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer;list-style:none;margin:0;padding:10px 12px;font-weight:650}
.headlines-collapsible>summary::-webkit-details-marker{display:none}
.headlines-collapsible>summary::before{content:'▸';margin-right:5px;color:#d4af37}
.headlines-collapsible[open]>summary::before{content:'▾'}
.headlines-expand-hint{font-size:11px;color:#94a4b8;font-weight:400;margin-left:auto}
.headlines-collapsible>.headlines-list{padding:0 12px 10px}
.ma-help{display:inline-block;vertical-align:baseline;margin-left:3px}
.ma-help:focus-visible{outline:2px solid #d4af37;outline-offset:2px}

/* v8cx asset-first responsive layout */
.asset-group-title{font-size:12px;letter-spacing:.12em;font-weight:800;color:var(--color-gold-bright);padding:8px 2px 3px}
.asset-group-silver{color:#bfc8d3;margin-top:16px}
.asset-group-title small{letter-spacing:normal;font-weight:500;color:var(--color-text-muted)}
.xag-tech-context,.calibration-compact{border:1px solid var(--color-border);border-radius:8px;padding:9px 12px;margin:8px 0;background:var(--color-surface-2)}
.xag-tech-context summary,.calibration-compact summary{font-size:12px;font-weight:700;cursor:pointer}
.header{padding:5px 10px;min-height:0;gap:7px}
.header-left{gap:8px}.header-right{gap:6px}
.header .logo svg{width:18px;height:18px}.header .logo-text{font-size:.84rem}
.header .price-value{font-size:1.15rem}.header .price-change{font-size:.7rem}
.header-xau-quote-ts{font-size:9px;max-width:140px}
.xag-header-quote{min-width:85px;padding:2px 6px}.xag-header-quote strong{font-size:14px}
.header .last-update,.header .sentiment-badge{display:none!important}
@media(max-width:700px){
.header{flex-wrap:nowrap;align-items:center;padding:5px 7px}
.header-left{flex:1;display:flex;align-items:center;flex-wrap:nowrap;gap:6px;min-width:0}
.header .logo svg{display:none}.header .logo-text{font-size:10px;white-space:nowrap}
.header .price-value{font-size:14px}.header .price-change{display:none}
.header .price-display{min-width:0}
.header-xau-quote-ts{font-size:9px;max-width:74px;line-height:1.1;overflow-wrap:anywhere}
.xag-header-quote{min-width:65px;border:0;border-left:1px solid var(--color-border);padding:0 3px}
.xag-header-quote strong{font-size:12px}.xag-header-quote small{font-size:8px}
.header-right{width:auto;flex:0 0 auto;justify-content:flex-end}
.header .refresh-btn{padding:3px 5px;min-width:25px}
}

/* Header price + quote timestamp only; percentage change remains in body KPIs. */
.header .price-change{display:none!important}

/* v8cy: refresh stays in the same price row on narrow screens */
.header{justify-content:flex-start}
.header-left{width:100%;min-width:0;display:flex;align-items:center;gap:7px;flex-wrap:nowrap}
.header-left .refresh-btn{flex:0 0 27px;width:27px;height:27px;padding:0;margin-left:auto;font-size:17px;line-height:1}
.header-right{display:none!important}
@media(max-width:700px){
 .header{padding:4px 6px}
 .header-left{gap:4px;min-width:0}
 .header .logo{flex:0 0 auto}.header .logo-text{font-size:10px;letter-spacing:0}
 .header .price-display{flex:0 1 auto;min-width:0}.header .price-value{font-size:clamp(11px,3.2vw,14px)}
 .header-xau-quote-ts{flex:0 1 72px;min-width:0;max-width:72px;font-size:8px}
 .xag-header-quote{flex:0 1 auto;min-width:55px;max-width:85px;padding:0 2px}
 .xag-header-quote strong{font-size:11px}
 .header-left .refresh-btn{flex:0 0 25px;width:25px;height:25px;margin-left:auto}
}
@media(max-width:370px){.header .logo-text{font-size:9px}.header-xau-quote-ts{max-width:55px}.xag-header-quote{min-width:50px}}

/* Compact hourly pivot forecast and 14-day validation section */
.pivot-hourly-panel{margin:14px 0;padding:12px;border:1px solid var(--border-color,#30343c);border-radius:10px;background:var(--panel-bg,rgba(20,22,28,.35));}
.pivot-hourly-stats{font-size:12px;color:var(--color-text,#bbb);margin:7px 0 10px;display:flex;flex-wrap:wrap;gap:8px 16px;}
.pivot-hourly-chart-wrap{height:190px;max-height:190px;margin:6px 0 14px;}
.pivot-hourly-table-wrap{max-height:280px;overflow:auto;margin:8px 0 12px;}
.pivot-hourly-table{width:100%;border-collapse:collapse;font-size:11px;white-space:nowrap;}
.pivot-hourly-table th,.pivot-hourly-table td{padding:5px 7px;text-align:right;border-bottom:1px solid rgba(140,140,140,.14);}
.pivot-hourly-table th:first-child,.pivot-hourly-table td:first-child{text-align:left;}
.pivot-hourly-table thead{position:sticky;top:0;background:var(--panel-bg,#20232a);z-index:2;}
.pivot-forecast-value{color:#42a5f5;font-weight:600}.pivot-actual-value{color:#d4af37;font-weight:600}.pivot-up{color:#26a69a}.pivot-down{color:#ef5350}

/* v8dc: concise XAU/XAG and 10-day pivot validation summaries */
.xag-table .xag-weekly-total{background:rgba(38,166,154,.11);font-weight:750;border-top:2px solid rgba(38,166,154,.45);border-bottom:1px solid rgba(38,166,154,.28)}
.xag-table .xag-weekly-total td:first-child{color:#55d6b0;letter-spacing:.04em}
.pivot-hourly-panel{padding:14px 14px 10px}
.pivot-hourly-stats{align-items:center;line-height:1.7}
.pivot-hourly-chart-wrap{height:270px;max-height:270px;position:relative;margin:8px 0 4px}
.pivot-hourly-legend{display:flex;flex-wrap:wrap;gap:8px 18px;align-items:center;font-size:11px;color:var(--color-text,#bbb);margin:0 0 12px}
.pivot-hourly-legend span{display:inline-flex;align-items:center;gap:6px}
.pivot-dot{display:inline-block;width:9px;height:9px;border-radius:50%}
.pivot-dot-green{background:#20c878}.pivot-dot-yellow{background:#f2c94c}.pivot-dot-red{background:#ef5350}.pivot-dot-gray{background:#aeb4bd}
.pivot-text-green{color:#20c878!important;font-weight:700}.pivot-text-yellow{color:#f2c94c!important;font-weight:700}.pivot-text-red{color:#ef5350!important;font-weight:700}
.pivot-hourly-table-wrap{max-height:245px;margin:10px 0 14px}
.pivot-hourly-table{font-size:11px;white-space:normal}
.pivot-hourly-table th,.pivot-hourly-table td{padding:7px 9px;line-height:1.35}
.pivot-hourly-table td{font-variant-numeric:tabular-nums}
.pivot-hourly-table td:first-child{white-space:nowrap}
@media(max-width:700px){
 .pivot-hourly-panel{padding:9px}
 .pivot-hourly-chart-wrap{height:235px;max-height:235px}
 .pivot-hourly-legend{gap:6px 12px;font-size:10px}
 .pivot-hourly-table{font-size:10px;min-width:620px}
 .pivot-hourly-table th,.pivot-hourly-table td{padding:6px 7px}
}


/* v8dd: optional actual +2h overlay control */
.pivot-hourly-controls{display:flex;justify-content:flex-end;align-items:center;margin:5px 0 2px}
.pivot-actual-toggle{display:inline-flex;align-items:center;gap:7px;font-size:11px;color:var(--color-text-muted);cursor:pointer;user-select:none}
.pivot-actual-toggle input{accent-color:var(--color-gold);width:14px;height:14px}

/* v8de: bidirectional hourly-pulse and monthly central-bank context */
.projection-central-bank-context{font-size:var(--text-xs);color:var(--color-text-muted);border:1px solid var(--color-border);border-radius:8px;padding:7px 10px;margin:6px 0;line-height:1.5}
.projection-central-bank-context strong{color:var(--color-text)}
.projection-central-bank-context .cb-buy{color:#16a34a;font-weight:700}
.projection-central-bank-context .cb-sell{color:#ef4444;font-weight:700}
.projection-central-bank-context .cb-na{color:#9ca3af}
.projection-central-bank-context a{color:var(--color-text-muted);text-decoration:underline;text-underline-offset:2px}
.projection-central-bank-context .cb-official-metric{display:inline-block;margin:1px 0}

/* v8dg: compact, user-expandable pivot summary tables */
.pivot-summary-details{border:1px solid var(--color-border,#30343c);border-radius:8px;margin:7px 0 10px;background:rgba(127,127,127,.035);overflow:hidden}
.pivot-summary-title{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 11px;cursor:pointer;list-style:none;font-size:11px;font-weight:600;color:var(--color-text-muted,#aeb2bc)}
.pivot-summary-title::-webkit-details-marker{display:none}
.pivot-summary-plus{font-size:16px;line-height:1;color:var(--color-gold,#d4af37);font-weight:700;transition:transform .15s ease}
.pivot-summary-details[open] .pivot-summary-plus{transform:rotate(45deg)}
.pivot-summary-details .pivot-hourly-table-wrap{margin:0 8px 8px;max-height:210px}
.pivot-summary-title .help-dot{margin-left:4px}
.pivot-hourly-table th[title],.pivot-summary-title[title]{cursor:help}
.pivot-hourly-stats .help-dot{margin-left:3px}
@media(max-width:600px){.pivot-summary-title{padding:8px;font-size:10px}.pivot-summary-details .pivot-hourly-table-wrap{max-height:170px}}

/* v8dm: expanded 48h pivot chart and compact transparent hover hints */
.projection-price-grid{grid-template-columns:minmax(0,1fr)!important}
.projection-price-grid .projection-chart-container{height:540px;min-height:540px;width:100%}
.pivot-hourly-chart-wrap{height:430px;max-height:430px;position:relative}
@media(max-width:900px){.projection-price-grid .projection-chart-container{height:430px;min-height:430px}.pivot-hourly-chart-wrap{height:340px;max-height:340px}}
[data-tooltip]{position:relative;cursor:help}
[data-tooltip]:hover::after,[data-tooltip]:focus-visible::after{content:attr(data-tooltip);position:absolute;z-index:1000;left:50%;bottom:calc(100% + 5px);transform:translateX(-50%);max-width:220px;width:max-content;white-space:normal;padding:4px 7px;border:1px solid rgba(150,160,175,.22);border-radius:5px;background:rgba(12,14,18,0);backdrop-filter:blur(2px);color:rgba(225,230,238,.82);font-size:10px;line-height:1.25;font-weight:400;box-shadow:none;pointer-events:none}


/* v8dn: explicit hour-by-hour XAU path and honest forecast validation */
.hourly-forecast-panel,.forecast-audit-panel{margin:16px 0;padding:16px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface-1,rgba(18,20,25,.45))}
.hourly-forecast-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:12px}
.hourly-forecast-heading h3{margin:0 0 5px;font-size:16px;color:var(--color-text);font-weight:700}
.hourly-forecast-heading p{margin:0;max-width:760px;font-size:11px;line-height:1.45;color:var(--color-text-muted)}
.hourly-forecast-summary,.forecast-audit-status{font-size:11px;color:var(--color-text-secondary);text-align:right;max-width:300px}
.hourly-forecast-table-wrap{max-height:590px;overflow:auto;border:1px solid var(--color-border);border-radius:8px}
.hourly-forecast-table{width:100%;border-collapse:collapse;font-size:11px;white-space:nowrap;font-variant-numeric:tabular-nums}
.hourly-forecast-table thead{position:sticky;top:0;z-index:2;background:var(--color-surface-2,#242832)}
.hourly-forecast-table th,.hourly-forecast-table td{padding:8px 10px;text-align:right;border-bottom:1px solid rgba(140,145,155,.13)}
.hourly-forecast-table th:nth-child(1),.hourly-forecast-table td:nth-child(1),.hourly-forecast-table th:nth-child(2),.hourly-forecast-table td:nth-child(2){text-align:left}
.hourly-forecast-table tbody tr:hover{background:rgba(150,160,175,.07)}
.hourly-forecast-table .forecast-price{font-weight:700;color:var(--color-gold-bright)}
.hourly-forecast-table .forecast-up td:nth-child(4),.hourly-forecast-table .forecast-up .forecast-direction{color:#27c78b}
.hourly-forecast-table .forecast-down td:nth-child(4),.hourly-forecast-table .forecast-down .forecast-direction{color:#ef7777}
.hourly-forecast-table .forecast-flat .forecast-direction{color:var(--color-text-muted)}
.forecast-direction{font-size:10px;font-weight:700}
.forecast-audit-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.forecast-audit-item{display:flex;flex-direction:column;gap:5px;padding:12px;border:1px solid var(--color-border);border-radius:8px;background:var(--color-surface-2,rgba(0,0,0,.12));min-width:0}
.forecast-audit-item strong{font-size:11px;color:var(--color-text-muted)}
.forecast-audit-item b{font-size:22px;color:var(--color-text);font-variant-numeric:tabular-nums}
.forecast-audit-item span,.forecast-audit-item small{font-size:10px;color:var(--color-text-secondary)}
.forecast-audit-item em{font-size:10px;line-height:1.35;color:#e5b85c;font-style:normal}
.projection-targets{grid-template-columns:repeat(4,minmax(0,1fr))}
.projection-summary{max-width:520px;line-height:1.5}
[data-tooltip]:hover::after,[data-tooltip]:focus-visible::after{background:transparent!important;border-color:transparent!important;backdrop-filter:none!important;box-shadow:none!important;font-size:9px!important;padding:3px 5px!important}
@media(max-width:850px){.forecast-audit-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.hourly-forecast-heading{display:block}.hourly-forecast-summary,.forecast-audit-status{text-align:left;margin-top:8px}}
@media(max-width:600px){.hourly-forecast-panel,.forecast-audit-panel{padding:10px}.hourly-forecast-table{font-size:10px;min-width:780px}.hourly-forecast-table th,.hourly-forecast-table td{padding:7px 8px}.forecast-audit-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.forecast-audit-item b{font-size:19px}}

/* v8dp: frozen live XAU-SPOT +2h forecast and realized outcome card */
.pivot-live-2h-card{margin:10px 0 12px;border:1px solid var(--color-border,#343943);border-radius:10px;overflow:hidden;background:rgba(127,127,127,.045)}
.pivot-live-main{padding:12px 14px;border-left:4px solid #54a7ff}
.pivot-live-main.pivot-live-green{border-left-color:#20c878;background:rgba(32,200,120,.055)}
.pivot-live-main.pivot-live-yellow{border-left-color:#f2c94c;background:rgba(242,201,76,.055)}
.pivot-live-main.pivot-live-red{border-left-color:#ef5350;background:rgba(239,83,80,.055)}
.pivot-live-main.pivot-live-pending{border-left-color:#54a7ff;background:rgba(84,167,255,.045)}
.pivot-live-prices{display:grid;grid-template-columns:minmax(110px,1fr) 24px minmax(130px,1.2fr) minmax(120px,1fr);gap:10px;align-items:center}
.pivot-live-prices>div{display:flex;flex-direction:column;gap:4px;min-width:0}
.pivot-live-label{font-size:10px;color:var(--color-text-muted,#9ba3af);line-height:1.35}
.pivot-live-prices strong{font-size:clamp(16px,2.1vw,22px);font-variant-numeric:tabular-nums;color:var(--color-text,#f0f2f5)}
.pivot-live-arrow{font-size:20px;text-align:center;color:var(--color-text-muted,#9ba3af)}
.pivot-live-outcome{display:flex;flex-wrap:wrap;gap:5px 12px;align-items:center;margin-top:10px;padding-top:9px;border-top:1px solid rgba(140,140,140,.18);font-size:12px;line-height:1.5}
.pivot-live-outcome b{font-size:10px;letter-spacing:.045em;color:var(--color-text-muted,#9ba3af)}
.pivot-live-green .pivot-live-outcome span{color:#20c878;font-weight:650}
.pivot-live-yellow .pivot-live-outcome span{color:#d8aa20;font-weight:650}
.pivot-live-red .pivot-live-outcome span{color:#ef5350;font-weight:650}
.pivot-live-foot{margin-top:5px;font-size:10px;color:var(--color-text-muted,#929aa6);line-height:1.4}
@media(max-width:650px){.pivot-live-prices{grid-template-columns:1fr 18px 1.15fr;gap:7px}.pivot-live-prices>div:last-child{grid-column:1/-1;display:flex;flex-direction:row;align-items:center;justify-content:space-between}.pivot-live-prices strong{font-size:17px}.pivot-live-main{padding:10px}}


/* v8dp restored local Probability Model with AI 48h scenario beneath it */
.prob-ai-48h-inline{margin-top:12px;padding:10px 12px;border:1px solid rgba(212,175,55,.24);border-radius:8px;background:rgba(127,127,127,.035)}
.prob-ai-48h-inline strong{display:block;margin:4px 0;color:var(--color-gold-bright,#d4af37);font-size:13px}
.prob-ai-48h-inline p{margin:3px 0 5px;font-size:12px;line-height:1.45;color:var(--color-text,#e6e8ed)}
.prob-ai-48h-inline small{display:block;color:var(--color-text-muted,#9aa0aa);font-size:10px}
.direction-source-table{min-width:1100px}
.direction-consensus-row{background:rgba(212,175,55,.08);font-weight:750}
.direction-consensus-row th{color:var(--color-gold,#d4af37)}
.direction-consensus-row small{white-space:normal;max-width:180px;line-height:1.3}
