/**
 * Volatility Calculator - Professional White Design
 * Marketing-Ready Financial Interface
 */

:root {
    /* Primary White Palette */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    
    /* Professional Accent Colors */
    --accent-primary: #0f172a;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    
    /* Borders & Shadows */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Typography */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-sans), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   RISK DISCLOSURE MODAL
   ============================================ */

.risk-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.risk-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.risk-modal-content {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.risk-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.risk-icon {
    font-size: 2rem;
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.risk-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.risk-modal-body {
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.risk-modal-body p {
    margin-bottom: 1rem;
}

.risk-modal-body p:last-child {
    margin-bottom: 0;
}

.risk-modal-body strong {
    color: var(--accent-amber);
    font-weight: 600;
}

.risk-modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    justify-content: center;
}

.risk-accept-btn {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
    width: 100%;
}

.risk-accept-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.risk-accept-btn:active {
    transform: translateY(0);
}

.risk-modal.hidden {
    display: none;
}

/* ============================================
   DASHBOARD HEADER
   ============================================ */

.dashboard-header {
    width: 100%;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.header-branding h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.platform-tag {
    color: var(--accent-blue);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.status-indicator.live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    display: inline-block;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.timestamp {
    color: var(--accent-blue);
    background: var(--bg-tertiary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    font-weight: 500;
}

/* ============================================
   CONTROL BAR
   ============================================ */

.control-bar {
    width: 100%;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.control-group label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

.control-group select,
.control-group input {
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    min-width: 140px;
    transition: all 0.2s;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.instrument-selector select {
    min-width: 200px;
    font-weight: 600;
}

.instrument-specs {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 80px;
}

.spec-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.spec-value {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.position-input {
    flex: 1;
    max-width: 220px;
}

.input-with-unit {
    position: relative;
}

.input-with-unit input {
    width: 100%;
    padding-right: 60px;
}

.unit-suffix {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 500;
}

.analyze-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    margin-left: auto;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
}

.analyze-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.analyze-btn:active {
    transform: translateY(0);
}

/* ============================================
   ANALYTICS DASHBOARD
   ============================================ */

.analytics-dashboard {
    width: 100%;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.loading-state {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

/* ============================================
   DASHBOARD GRID LAYOUT
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    width: 100%;
}

/* Price Chart - Full Width */
.volatility-section.price-section {
    grid-column: 1 / -1;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Price Info Section */
.volatility-section.price-info {
    grid-column: 1 / -1;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Two-column layout for price chart and term structure */
.price-info-two-column {
    grid-column: 1 / -1;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.chart-term-structure-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.chart-container {
    min-width: 0;
}

/* ============================================
   TERM STRUCTURE - FIXED DESIGN
   ============================================ */

.volatility-section.term-structure {
    grid-column: 1 / -1;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Section header with icon */
.section-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h3::before {
    content: "📊";
    font-size: 1.25rem;
}

/* Centered chart with better contrast */
.term-structure-chart {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4rem;
    height: 240px;
    padding: 1.5rem 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    width: 100%;
}

/* Individual bars */
.term-bar {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    cursor: pointer;
    min-width: 80px;
    height: 100%;
    position: relative;
    transition: transform 0.2s ease;
}

.term-bar:hover {
    transform: translateY(-4px);
}

/* Value label - positioned above bar */
.term-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
    order: -1;
}

/* The bar - SOLID dark blue for contrast */
.term-bar-fill {
    width: 56px;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    min-height: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    position: relative;
}

/* Texture overlay */
.term-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.08) 4px,
        rgba(255, 255, 255, 0.08) 8px
    );
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* SINGLE label below bar - no redundancy */
.term-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
}

/* Hover effects */
.term-bar:hover .term-bar-fill {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 50%, #1e3a8a 100%);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.term-bar:hover .term-value {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Container in side panel */
.term-structure-container {
    min-width: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-light);
}

.term-structure-container h5 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.term-structure-container .term-structure-chart {
    height: 200px;
    padding: 1rem;
    gap: 2rem;
    background: var(--bg-primary);
}

.term-structure-container .term-bar-fill {
    width: 40px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

/* ============================================
   CHART CONTAINER
   ============================================ */

.mini-chart-container {
    position: relative;
    width: 100%;
    height: 320px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

#miniPriceChart {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   METRIC CARDS
   ============================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    min-width: 0;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.metric-name {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.metric-value-lg {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* ============================================
   RISK BADGES
   ============================================ */

.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.risk-badge.risk-low { 
    background: rgba(16, 185, 129, 0.1); 
    color: #059669; 
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.risk-badge.risk-normal { 
    background: rgba(59, 130, 246, 0.1); 
    color: #2563eb; 
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.risk-badge.risk-moderate { 
    background: rgba(245, 158, 11, 0.1); 
    color: #d97706; 
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.risk-badge.risk-high { 
    background: rgba(239, 68, 68, 0.1); 
    color: #dc2626; 
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================
   VOLATILITY PANEL V2 - PROFESSIONAL DESIGN
   ============================================ */

.volatility-panel-v2 {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    font-family: var(--font-sans);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    grid-column: 1 / -1;
}

/* Header */
.panel-header-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-light);
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.panel-header-v2 h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.live-pulse {
    color: var(--accent-green);
    font-size: 0.75rem;
    animation: pulse 2s infinite;
}

.live-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.ticker-badge {
    background: var(--accent-blue);
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 600;
}

.update-time {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

/* Panel Body */
.panel-body-v2 {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Main Visualization Row */
.main-visualization-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* Cards */
.viz-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header h4 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.period-tag {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.current { background: var(--accent-blue); }
.dot.start { background: var(--text-muted); }

.chart-wrapper {
    flex: 1;
    min-height: 220px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.chart-footer {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.metric-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    border: 1px solid var(--border-light);
}

.metric-pill.highlight {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.2);
}

.pill-label {
    color: var(--text-tertiary);
    font-weight: 500;
}

.pill-value {
    color: var(--accent-blue);
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Term Structure Card */
.term-chart-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    min-height: 260px;
}

.term-legend {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.term-item {
    text-align: center;
}

.term-tenor {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.term-val {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* Metrics Grid V2 */
.metrics-grid-v2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.metric-card-v2 {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.metric-card-v2:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-card-v2.primary {
    border-color: var(--accent-blue);
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(59, 130, 246, 0.03) 100%);
}

.metric-header-v2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-icon {
    font-size: 1.125rem;
}

.metric-label-v2 {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-value-v2 {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.metric-context {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.garch-tag, .cvar-tag {
    color: var(--accent-amber);
    font-weight: 600;
}

.regime-tag {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    text-transform: uppercase;
    font-weight: 600;
}

/* Risk Badge Colors */
.risk-badge-v2 {
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.risk-low { color: var(--accent-green); }
.risk-normal { color: var(--accent-blue); }
.risk-moderate { color: var(--accent-amber); }
.risk-high { color: var(--accent-red); }
.risk-critical { color: #dc2626; }

.risk-bar-container {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.risk-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-amber) 50%, var(--accent-red) 100%);
}

/* Market Structure Row */
.market-structure-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.structure-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.structure-card h5 {
    margin: 0 0 1rem 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.skew-visual, .kurtosis-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.skew-bar-v2 {
    width: 60px;
    height: 8px;
    border-radius: 4px;
    background: var(--border-medium);
    position: relative;
}

.skew-bar-v2::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    width: 2px;
    height: 16px;
    background: var(--text-primary);
}

.skew-value-v2 {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.kurt-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kurt-badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
}

.structure-desc {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.jb-result {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* Rolling Stats Bar */
.rolling-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-item.highlight .stat-value {
    color: var(--accent-blue);
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border-light);
}

.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.strategy-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.confidence-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ============================================
   TOOLTIP SYSTEM
   ============================================ */

.tooltip-portal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
}

.tooltip-container {
    display: inline-flex;
    position: relative;
}

.tooltip-trigger:hover {
    background: var(--accent-blue);
    color: white;
}

.tooltip-icon {
    width: 14px;
    height: 14px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    border-radius: 50%;
    font-size: 0.625rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.global-tooltip.visible {
    z-index: 10002;
    opacity: 1;
    transform: translateY(0);
}

.global-tooltip em {
    color: var(--accent-amber);
    font-style: normal;
}

.metric-card-v2, .viz-card, .structure-card, .strategy-section {
    position: relative;
}

/* ============================================
   METHODOLOGY SECTION
   ============================================ */

.methodology-section {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    padding: 3rem 2rem;
    width: 100%;
}

.methodology-section .container {
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.method-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.2s;
}

.method-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.method-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.method-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.metrics-explanation {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.metrics-list-pro {
    display: grid;
    gap: 1rem;
}

.metric-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-row dt {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.metric-row dd {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .main-visualization-row {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid-v2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .market-structure-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .chart-term-structure-row {
        grid-template-columns: 1fr;
    }
    
    .term-structure-container {
        margin-top: 1rem;
    }
    
    .control-bar {
        padding: 1rem;
    }
    
    .analyze-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .dashboard-header,
    .analytics-dashboard,
    .methodology-section {
        padding: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid-v2 {
        grid-template-columns: 1fr;
    }
    
    .metric-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .mini-chart-container {
        height: 240px;
    }
    
    .header-meta {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-end;
    }

    .term-structure-chart {
        gap: 2rem;
        height: 200px;
        padding: 1rem;
    }
    
    .term-bar {
        min-width: 60px;
    }
    
    .term-bar-fill {
        width: 44px;
    }
    
    .term-value {
        font-size: 0.875rem;
        padding: 0.375rem 0.625rem;
    }
    
    .term-label {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

@media (max-width: 500px) {
    .instrument-specs {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .rolling-stats-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-divider {
        width: 100%;
        height: 1px;
    }
}

@media (max-width: 480px) {
    .term-structure-chart {
        gap: 1.25rem;
    }
    
    .term-bar-fill {
        width: 32px;
    }
    
    .term-value {
        font-size: 0.75rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }
.text-muted { color: var(--text-muted); }

.bg-subtle { background: var(--bg-secondary); }
.border-subtle { border-color: var(--border-light); }

.font-mono { font-family: var(--font-mono), 'Consolas', 'Monaco', monospace; }
.font-sans { font-family: var(--font-sans), system-ui, sans-serif; }

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Smooth transitions for interactive elements */
.metric-card, 
.viz-card, 
.structure-card,
button, 
input, 
select {
    transition: all 0.2s ease;
}

/* Focus states for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Selection colors */
::selection {
    background: rgba(59, 130, 246, 0.2);
    color: var(--text-primary);
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS - WCAG 2.1 AA / EN 301 549
   ============================================ */

/* Focus indicators - 3:1 contrast ratio minimum */
.tooltip-trigger:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--accent-blue);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Ensure sufficient color contrast */
.strategy-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
/* Legacy Microsoft implementation */
@media screen and (-ms-high-contrast: active) {
  .tooltip-trigger {
        border: 2px solid currentColor;
    }
    
    .strategy-section,
    .metric-card-v2,
    .viz-card {
        border: 2px solid var(--text-primary);
    }
}

/* Modern standard implementation */
@media (prefers-contrast: high) {
    .tooltip-trigger {
        border: 2px solid currentColor;
    }
    
    .strategy-section,
    .metric-card-v2,
    .viz-card {
        border: 2px solid var(--text-primary);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tooltip-trigger,
    .global-tooltip,
    .strategy-section * {
        animation: none !important;
        transition: none !important;
    }
}

/* Tooltip visibility - ensure not hidden by overflow */
.strategy-section,
.metric-card-v2,
.viz-card,
.structure-card {
    position: relative;
    overflow: visible; /* Allow tooltips to extend beyond */
}

.global-tooltip[hidden] {
    display: none;
}

.global-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ARIA live regions */
[aria-live="polite"] {
    transition: background-color 0.3s;
}

[aria-live="polite"]:focus-within {
    background-color: rgba(59, 130, 246, 0.05);
}

/* Ensure interactive elements have minimum touch target size */
.tooltip-trigger,
button,
select,
input {
    min-height: 44px;
    min-width: 44px;
}

/* Color contrast fixes for risk badges */
.tail-badge.elevated {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
    border: 2px solid #dc2626;
    font-weight: 700;
}

/* Scenario bars - accessibility enhancements */
.scenario-bar {
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-medium);
}

.scenario-bar:focus-within {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Print styles for accessibility */
@media print {
    .global-tooltip,
    .tooltip-trigger {
        display: none;
    }
    
    .strategy-section {
        page-break-inside: avoid;
    }
}
/* ============================================
   PROFESSIONAL RECOMMENDATION - WHITE THEME
   WCAG 2.1 AA & EN 301 549 COMPLIANT
   ============================================ */

.professional-rec-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-family: var(--font-sans);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

/* Strategy Header - White Background */
.rec-strategy-header {
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-light);
    color: var(--text-primary);
}

.strategy-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.strategy-code {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-medium);
    min-width: 80px;
    text-align: center;
}

.strategy-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.strategy-meta {
    display: flex;
    gap: 0.75rem;
}

.conviction-badge, .horizon-badge {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--border-light);
}

/* Panel Sections - White Background */
.rec-position-panel,
.rec-risk-panel,
.rec-context-panel,
.rec-scenarios,
.rec-rationale-pro,
.rec-warnings,
.rec-execution {
    padding: 1.25rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

/* Section Headings with Tooltips */
.rec-position-panel h5,
.rec-risk-panel h5,
.rec-context-panel h5,
.rec-scenarios h5,
.rec-rationale-pro h5,
.rec-warnings h5,
.rec-execution h5 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-subtitle {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: none;
}

/* Grid Layouts */
.position-grid,
.risk-grid,
.context-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.pos-metric,
.risk-param,
.context-item,
.exec-item {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.pos-metric:hover,
.risk-param:hover,
.context-item:hover,
.exec-item:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-sm);
}

.pos-label,
.risk-label,
.context-label,
.exec-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.pos-value,
.risk-value,
.context-value,
.exec-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.pos-value.warning {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* Scaling Plan */
.scaling-plan {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-left: 4px solid var(--accent-amber);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.scaling-title {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.scaling-steps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    min-width: 60px;
}

.step-pct {
    background: var(--accent-blue);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

.step-trigger {
    font-size: 0.625rem;
    color: var(--text-tertiary);
    text-align: center;
    max-width: 80px;
    line-height: 1.3;
}

.step-arrow {
    color: var(--text-muted);
    font-size: 1.25rem;
    font-weight: 300;
}

/* Tail Risk Indicator */
.tail-risk-indicator {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.tail-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tail-badge {
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 2px solid transparent;
}

.tail-badge.normal {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.3);
}

.tail-badge.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.3);
}

.tail-badge.elevated {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.3);
    font-weight: 700;
}

.stress-loss {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-left: auto;
    font-family: var(--font-mono);
}

/* Hedge Recommendation */
.hedge-recommendation {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--accent-green);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.875rem;
}

.hedge-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.hedge-value {
    color: var(--text-primary);
    font-weight: 700;
}

/* Regime Colors - High Contrast for Accessibility */
.regime-low { 
    color: #059669; 
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.regime-normal { 
    color: #2563eb; 
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.regime-moderate { 
    color: #d97706; 
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.regime-high { 
    color: #dc2626; 
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.regime-critical { 
    color: #991b1b; 
    font-weight: 700;
    background: rgba(239, 68, 68, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 2px solid #dc2626;
}

/* Scenario Analysis */
.scenario-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scenario {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.scenario:hover {
    border-color: var(--accent-blue);
}

.scenario-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.scenario-bar {
    height: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s ease;
    position: relative;
}

.bull .bar-fill { 
    background: linear-gradient(90deg, #10b981, #059669);
}

.base .bar-fill { 
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.bear .bar-fill { 
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Progressbar accessibility */
.scenario-bar[role="progressbar"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 8px,
        rgba(255,255,255,0.3) 8px,
        rgba(255,255,255,0.3) 16px
    );
    z-index: 1;
}

.scenario-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
    font-family: var(--font-mono);
}

/* Investment Thesis */
.rec-rationale-pro p {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-blue);
}

/* Risk Warnings */
.rec-warnings {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
}

.rec-warnings h5 {
    color: #dc2626;
}

.warning-item {
    color: #dc2626;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    list-style: none;
    padding-left: 1.75rem;
    position: relative;
    line-height: 1.5;
}

.warning-item::before {
    content: '⚠';
    position: absolute;
    left: 0;
    color: #dc2626;
    font-weight: 700;
    font-size: 1rem;
}

/* Execution Protocol */
.execution-params {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.urgency-emergency { 
    color: #991b1b; 
    font-weight: 700;
    background: rgba(239, 68, 68, 0.15);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 2px solid #dc2626;
}

.urgency-critical { 
    color: #dc2626; 
    font-weight: 700;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.urgency-high { 
    color: #d97706; 
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.urgency-medium { 
    color: #2563eb; 
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.urgency-low { 
    color: #059669; 
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ============================================
   TOOLTIP SYSTEM - WCAG 2.1 AA COMPLIANT
   ============================================ */

.tooltip-container {
    display: inline-flex;
    position: relative;
}

.tooltip-trigger {
    width: 24px;
    height: 24px;
    background: var(--bg-tertiary);
    color: var(--accent-blue);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: help;
    border: 2px solid var(--border-medium);
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    position: relative;
    min-width: 24px;
    min-height: 24px;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus-visible {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    transform: scale(1.1);
}

.tooltip-trigger:focus-visible {
    outline: 3px solid var(--accent-blue);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.tooltip-trigger span[aria-hidden="true"] {
    line-height: 1;
    font-size: 0.875rem;
}

/* Global Tooltip - Fixed Position for No Cutoff */
.global-tooltip {
    position: fixed;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--accent-blue);
    box-shadow: var(--shadow-xl);
    font-size: 0.875rem;
    max-width: 400px;
    width: max-content;
    opacity: 0;
    transform: translateY(-8px) translateX(-50%);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 10001;
    pointer-events: none;
    line-height: 1.6;
    white-space: normal;
    word-wrap: break-word;
    hyphens: auto;
    visibility: hidden;
    left: 50%;
    top: auto;
}

.global-tooltip .bullet-list div {
    margin-bottom: 0.25rem;
}

.global-tooltip[hidden] {
    display: none;
}

.global-tooltip.visible {
    opacity: 1;
    transform: translateY(0) translateX(-50%);
    pointer-events: auto;
    visibility: visible;
}

.global-tooltip strong {
    color: var(--accent-blue);
    font-weight: 700;
    display: inline;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.global-tooltip p {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
}

.global-tooltip p:last-child {
    margin-bottom: 0;
}

/* Tooltip Arrow */
.global-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: var(--accent-blue);
}

/* Tooltip arrow when pointing down (default) */
.global-tooltip::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: var(--accent-blue);
}

/* Tooltip arrow when pointing up (tooltip above trigger) */
.global-tooltip.tooltip-above::before {
    top: auto;
    bottom: -16px;
    border-bottom-color: transparent;
    border-top-color: var(--accent-blue);
}

/* Ensure tooltip-above class is properly positioned */
.global-tooltip.tooltip-above {
    transform: translateY(0) translateX(-50%);
    margin-top: -8px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .professional-rec-container {
        border: 2px solid var(--text-primary);
    }
    
    .rec-strategy-header {
        border-bottom: 3px solid var(--text-primary);
    }
    
    .strategy-code {
        border: 3px solid var(--text-primary);
    }
    
    .tooltip-trigger {
        border: 3px solid currentColor;
    }
    
    .global-tooltip {
        border: 3px solid var(--text-primary);
        box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    }
    
    .scenario {
        border: 2px solid var(--text-primary);
    }
    
    .scenario-bar {
        border: 2px solid var(--text-primary);
    }
    
    .pos-metric,
    .risk-param,
    .context-item,
    .exec-item {
        border: 2px solid var(--text-primary);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .professional-rec-container *,
    .tooltip-trigger,
    .global-tooltip,
    .bar-fill,
    .step,
    .scenario {
        animation: none !important;
        transition: none !important;
    }
    
    .global-tooltip.visible {
        z-index: 10002;
        transform: translateY(0) translateX(-50%);
    }
}

/* Focus Visible for Keyboard Navigation */
.rec-strategy-header:focus-within,
.rec-position-panel:focus-within,
.rec-risk-panel:focus-within,
.rec-context-panel:focus-within,
.rec-scenarios:focus-within,
.rec-rationale-pro:focus-within,
.rec-warnings:focus-within,
.rec-execution:focus-within {
    outline: 3px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .professional-rec-container {
        box-shadow: none;
        border: 2px solid #000;
    }
    
    .global-tooltip,
    .tooltip-trigger {
        display: none !important;
    }
    
    .rec-strategy-header {
        background: #fff !important;
        color: #000 !important;
        border-bottom: 2px solid #000;
    }
    
    .strategy-code {
        background: #f0f0f0 !important;
        border: 2px solid #000;
    }
}

/* ============================================
   ENHANCED HOW-TO-USE SECTION
   ============================================ */

.section-header-pro {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 500;
}

.tool-overview {
    max-width: 900px;
    margin: 0 auto 2.5rem;
    text-align: center;
}

.lead-text {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-blue);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* How to Use Grid */
.how-to-use-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin-bottom: 3rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .how-to-use-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.usage-steps h3,
.methodology-deep-dive h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-blue);
}

.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.steps-list li {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    font-family: var(--font-mono);
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.step-content strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9375rem;
}

.step-content span {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Methodology Grid Compact */
.method-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.method-grid-compact .method-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.method-grid-compact .method-card h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.method-grid-compact .method-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.method-grid-compact .method-card em {
    color: var(--accent-amber);
    font-style: normal;
    font-weight: 600;
}

/* Metrics Reference */
.metrics-reference {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.metrics-reference h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.metric-threshold {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
}

/* Use Cases */
.use-cases {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.use-cases h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.use-case-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.use-case {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.use-case:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}