/* ==================== AI Components Styles ==================== */

/* === AI Page Container === */
.ai-page-container {
    padding: 20px;
    min-height: 100%;
}

/* === Fleet Analytics Dashboard === */
.fleet-dashboard-advanced {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fleet-dashboard-advanced .page-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--radius);
    padding: 20px 25px;
    border: 1px solid var(--border-primary);
}

.fleet-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.fleet-stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-primary);
    transition: all 0.2s;
}

.fleet-stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-blue { border-left: 4px solid var(--accent-info); }
.stat-card-green { border-left: 4px solid var(--accent-success); }
.stat-card-yellow { border-left: 4px solid var(--accent-warning); }
.stat-card-red { border-left: 4px solid var(--accent-danger); }
.stat-card-purple { border-left: 4px solid #a855f7; }

.stat-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    font-size: 1.5rem;
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-info .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Analytics Cards */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.analytics-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.analytics-card .card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analytics-card .card-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.analytics-card .card-body {
    padding: 20px;
}

.ai-badge {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Well Status Chart */
.well-status-chart .status-bars {
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.well-status-chart .bar-fill.healthy {
    height: 100%;
    background: linear-gradient(90deg, #3fb950, #2ea043);
}

.well-status-chart .status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.well-status-chart .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.well-status-chart .legend-indicator {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-item.healthy .legend-indicator { background: #3fb950; }
.legend-item.warning .legend-indicator { background: #d29922; }
.legend-item.critical .legend-indicator { background: #f85149; }
.legend-item.offline .legend-indicator { background: #6e7681; }

.legend-count {
    font-weight: 600;
    font-family: var(--font-mono);
}

.legend-pct {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Donut Chart */
.donut-chart-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.donut-chart {
    width: 150px;
    height: 90px;
}

/* Correlation Matrix */
.correlation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.correlation-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.correlation-params {
    flex: 0 0 150px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.correlation-bar-container {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.correlation-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.correlation-bar.high { background: linear-gradient(90deg, #3fb950, #2ea043); }
.correlation-bar.medium { background: linear-gradient(90deg, #d29922, #b08800); }
.correlation-bar.low { background: linear-gradient(90deg, #f85149, #d73a49); }

.correlation-value {
    flex: 0 0 50px;
    font-weight: 600;
    font-family: var(--font-mono);
    text-align: right;
}

.correlation-value.high { color: #3fb950; }
.correlation-value.medium { color: #d29922; }
.correlation-value.low { color: #f85149; }

.correlation-insights {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 15px;
    margin-top: 20px;
}

.insights-title {
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.insights-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.insights-list li {
    margin-bottom: 5px;
}

/* Ranking Table */
.ranking-table-card {
    width: 100%;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th {
    text-align: left;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ranking-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-primary);
}

.ranking-row:hover {
    background: var(--bg-tertiary);
}

.rank-badge {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.rank-badge.rank-1 { background: linear-gradient(135deg, #ffd700, #f59e0b); color: #000; }
.rank-badge.rank-2 { background: linear-gradient(135deg, #c0c0c0, #9ca3af); color: #000; }
.rank-badge.rank-3 { background: linear-gradient(135deg, #cd7f32, #a855f7); color: #fff; }
.rank-badge.rank-other { background: var(--bg-tertiary); color: var(--text-secondary); }

.well-icon {
    margin-right: 8px;
}

.efficiency-bar-container {
    width: 80px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.efficiency-bar {
    height: 100%;
    background: var(--accent-info);
    border-radius: 3px;
}

.health-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.health-badge.healthy { background: #bbf7d0; color: #3fb950; }
.health-badge.warning { background: #fde68a; color: #d29922; }
.health-badge.critical { background: #fecaca; color: #f85149; }

.trend-indicator {
    font-size: 1.2rem;
    font-weight: 700;
}

.trend-up { color: #3fb950; }
.trend-down { color: #f85149; }
.trend-stable { color: var(--text-secondary); }

/* === Explainability Panel === */
.explainability-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.explainability-panel .panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.explainability-panel .panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

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

.prediction-type {
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.details-toggle {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 0.9rem;
}

.explanation-content {
    padding: 20px;
}

.prediction-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.prediction-value .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.prediction-value .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.confidence-meter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.confidence-meter .meter-bar {
    width: 100px;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.confidence-meter .meter-fill {
    height: 100%;
    background: var(--accent-success);
}

/* Top Factors */
.top-factors {
    margin-bottom: 20px;
}

.factors-title {
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.factors-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.factor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-primary);
}

.factor-name {
    flex: 1;
    color: var(--text-primary);
}

.factor-value {
    flex: 0 0 80px;
    text-align: right;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.factor-impact {
    flex: 0 0 80px;
    text-align: right;
    font-weight: 600;
    font-family: var(--font-mono);
}

.factor-impact.positive { color: #f85149; }
.factor-impact.negative { color: #3fb950; }

/* Feature Chart */
.feature-chart {
    margin-top: 20px;
}

.chart-title {
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-label {
    flex: 0 0 120px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.bar-container {
    flex: 1;
    height: 20px;
    background: var(--bg-tertiary);
    position: relative;
}

.bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-primary);
}

.bar-fill {
    position: absolute;
    height: 100%;
}

.bar-positive { background: rgba(248, 81, 73, 0.6); }
.bar-negative { background: rgba(63, 185, 80, 0.6); }

.feature-value {
    flex: 0 0 60px;
    text-align: right;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.chart-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-negative { color: #3fb950; }
.legend-positive { color: #f85149; }

/* Waterfall Chart */
.waterfall-section {
    margin-top: 30px;
}

.section-title {
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.waterfall-chart {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 15px;
}

.waterfall-svg {
    width: 100%;
    height: auto;
}

.model-info {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-primary);
}

.info-item {
    font-size: 0.85rem;
}

.info-label {
    color: var(--text-secondary);
    margin-right: 5px;
}

.info-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* === Causal Graph Viewer === */
.causal-graph-viewer {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.causal-graph-viewer .viewer-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.graph-container {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.graph-svg-container {
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    min-height: 350px;
}

.causal-graph-svg {
    width: 100%;
    height: 100%;
}

.causal-node {
    fill: var(--bg-secondary);
    stroke: var(--border-primary);
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.2s;
}

.causal-node:hover {
    stroke: var(--accent-primary);
    stroke-width: 3;
}

.causal-node.node-selected {
    stroke: var(--accent-primary);
    stroke-width: 3;
    fill: #dbeafe;
}

.causal-node.node-in-path {
    fill: #eff6ff;
}

.node-input { fill: #bbf7d0; stroke: #3fb950; }
.node-hidden { fill: #fde68a; stroke: #d29922; }
.node-output { fill: #fecaca; stroke: #f85149; }

.node-label {
    fill: var(--text-primary);
    font-size: 10px;
    pointer-events: none;
}

.node-icon {
    fill: var(--text-primary);
    font-size: 14px;
    pointer-events: none;
}

.causal-edge {
    stroke: rgba(201, 169, 97, 0.4);
    fill: none;
}

.edge-highlighted {
    stroke: var(--accent-primary);
    stroke-width: 3 !important;
}

.edge-label {
    fill: var(--text-secondary);
    font-size: 9px;
}

.variables-panel {
    flex: 0 0 200px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 15px;
}

.panel-subtitle {
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.variable-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.variable-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.variable-item:hover {
    background: var(--bg-secondary);
}

.variable-item.selected {
    background: #dbeafe;
    border: 1px solid var(--accent-primary);
}

.var-icon { font-size: 1rem; }
.var-name { flex: 1; font-size: 0.9rem; }
.var-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
}

.badge-input { background: #bbf7d0; color: #3fb950; }
.badge-hidden { background: #fde68a; color: #d29922; }
.badge-output { background: #fecaca; color: #f85149; }

.graph-legend {
    display: flex;
    gap: 20px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-primary);
    flex-wrap: wrap;
}

.graph-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-node {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid;
}

.legend-node.input { background: #bbf7d0; border-color: #3fb950; }
.legend-node.hidden { background: #fde68a; border-color: #d29922; }
.legend-node.output { background: #fecaca; border-color: #f85149; }

.legend-edge {
    width: 30px;
    height: 2px;
    background: var(--accent-primary);
}

/* === Root Cause Panel === */
.root-cause-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.root-cause-panel .panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.root-cause-panel .panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.rca-content {
    padding: 20px;
}

.diagnosed-problem {
    background: #fef2f2;
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
}

.problem-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

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

.problem-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.problem-text {
    color: #f85149;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.confidence-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.confidence-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.confidence-bar {
    flex: 1;
    max-width: 150px;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--accent-success);
}

.confidence-value {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Root Causes Section */
.root-causes-section,
.interventions-section {
    margin-bottom: 20px;
}

.root-causes-section .section-title,
.interventions-section .section-title {
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.causes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cause-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.cause-item:hover {
    background: var(--bg-secondary);
}

.cause-item.expanded {
    border: 1px solid var(--accent-primary);
}

.cause-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
}

.cause-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.cause-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.cause-strength {
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.cause-strength.high { background: #fecaca; color: #f85149; }
.cause-strength.medium { background: #fde68a; color: #d29922; }
.cause-strength.low { background: #bbf7d0; color: #3fb950; }

.cause-details {
    padding: 0 15px 15px 15px;
    border-top: 1px solid var(--border-primary);
}

.causal-path {
    margin-bottom: 15px;
}

.path-label,
.evidence-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.path-nodes {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.path-node {
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.path-arrow {
    color: var(--text-secondary);
}

.evidence-list ul {
    margin: 0;
    padding-left: 20px;
}

.evidence-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Interventions */
.interventions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.intervention-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 15px;
    border-left: 4px solid var(--accent-primary);
}

.intervention-item.priority-high { border-left-color: #f85149; }
.intervention-item.priority-medium { border-left-color: #d29922; }
.intervention-item.priority-low { border-left-color: #3fb950; }

.int-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.int-action {
    font-weight: 600;
    color: var(--text-primary);
}

.int-priority {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
}

.priority-high .int-priority { background: #fecaca; color: #f85149; }
.priority-medium .int-priority { background: #fde68a; color: #d29922; }
.priority-low .int-priority { background: #bbf7d0; color: #3fb950; }

.int-details {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.int-target,
.int-effect,
.int-cost {
    font-size: 0.9rem;
}

.detail-label {
    color: var(--text-secondary);
    margin-right: 5px;
}

.analysis-footer {
    padding-top: 15px;
    border-top: 1px solid var(--border-primary);
}

.timestamp {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* === What-If Scenario === */
.what-if-scenario {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.what-if-scenario .panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.what-if-scenario .panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.toggle-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.scenario-content {
    padding: 20px;
}

/* Parameters Section */
.parameters-section {
    margin-bottom: 25px;
}

.parameters-section .section-title {
    font-weight: 600;
    margin: 0 0 20px 0;
    color: var(--text-primary);
}

.parameter-control {
    margin-bottom: 20px;
}

.param-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.param-label {
    font-weight: 500;
    color: var(--text-primary);
}

.param-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-primary);
}

.slider-container {
    margin-bottom: 8px;
}

.param-slider {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.param-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 5px 0 0 0;
}

.duration-buttons {
    display: flex;
    gap: 8px;
}

.duration-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
}

.duration-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.run-btn {
    flex: 1;
}

.reset-btn {
    flex: 0 0 100px;
}

/* Results Section */
.results-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--border-primary);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.results-actions .btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.risk-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.risk-banner.risk-high {
    background: #fee2e2;
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: #f85149;
}

.risk-banner.risk-medium {
    background: #fef3c7;
    border: 1px solid rgba(210, 153, 34, 0.3);
    color: #d29922;
}

.risk-banner.risk-low {
    background: #dcfce7;
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: #3fb950;
}

.risk-icon { font-size: 1.2rem; }
.risk-text { font-weight: 500; }

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.prediction-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.prediction-card.warning {
    border: 1px solid rgba(248, 81, 73, 0.3);
    background: #fef2f2;
}

.prediction-card .card-icon {
    font-size: 1.5rem;
}

.prediction-card .card-content {
    flex: 1;
}

.prediction-card .card-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
}

.card-value-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.prediction-card .card-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.prediction-card .card-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    margin-top: 4px;
}

.change-up { color: #f85149; }
.change-down { color: #3fb950; }
.change-neutral { color: var(--text-secondary); }

/* Risk Metrics */
.risk-metrics {
    margin-bottom: 20px;
}

.risk-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.risk-label {
    flex: 0 0 120px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.risk-bar-container {
    flex: 1;
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: 5px;
    overflow: hidden;
}

.risk-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s;
}

.risk-bar.low { background: linear-gradient(90deg, #3fb950, #2ea043); }
.risk-bar.medium { background: linear-gradient(90deg, #d29922, #b08800); }
.risk-bar.high { background: linear-gradient(90deg, #f85149, #d73a49); }

.risk-value {
    flex: 0 0 50px;
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Confidence Section */
.confidence-section {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.confidence-section .confidence-bar {
    flex: 1;
    max-width: none;
}

/* Recommendations */
.recommendations-section {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 15px;
}

.rec-title {
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.rec-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rec-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.rec-item:last-child {
    border-bottom: none;
}

.rec-item::before {
    content: ">";
    margin-right: 8px;
    color: var(--accent-primary);
}

/* Comparison Section */
.comparison-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--border-primary);
}

.scenarios-table {
    overflow-x: auto;
}

.scenarios-table table {
    width: 100%;
    border-collapse: collapse;
}

.scenarios-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.scenarios-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-primary);
    font-family: var(--font-mono);
}

.scenarios-table .risk-high {
    color: #f85149;
    font-weight: 600;
}

/* Loading and Error States */
.loading-state,
.error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: var(--text-secondary);
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-state {
    color: #f85149;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .fleet-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .fleet-stats-grid {
        grid-template-columns: 1fr;
    }

    .graph-container {
        flex-direction: column;
    }

    .variables-panel {
        flex: none;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}
