:root {
    --f2-primary: #206bc4;
    --f2-success: #2fb344;
    --f2-danger: #d63939;
    --f2-warning: #f76707;
    --f2-info: #4299e1;
    --f2-purple: #7c3aed;
    --f2-bg: #f1f5f9;
}
* { box-sizing: border-box; }
body { background: var(--f2-bg); font-family: 'Inter', -apple-system, sans-serif; margin: 0; }

/* Sidebar */
.f2-sidebar {
    width: 260px; position: fixed; top: 0; left: 0; bottom: 0;
    background: #1e293b; color: #94a3b8; overflow-y: auto; z-index: 100;
}
.f2-sidebar .logo { padding: 20px 24px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #334155; }
.f2-sidebar .logo span { color: var(--f2-info); }
.f2-sidebar .nav-section { padding: 16px 0 4px 24px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: #64748b; }
.f2-sidebar a {
    display: flex; align-items: center; gap: 10px; padding: 10px 24px;
    color: #94a3b8; text-decoration: none; font-size: 13px; transition: all 0.15s;
}
.f2-sidebar a:hover, .f2-sidebar a.active { color: #fff; background: rgba(255,255,255,0.06); }
.f2-sidebar a.active { border-right: 3px solid var(--f2-info); }

/* Main */
.f2-main { margin-left: 260px; padding: 24px 32px; }

/* Header */
.f2-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.f2-header h1 { font-size: 22px; font-weight: 700; color: #1e293b; margin: 0; }
.f2-header .subtitle { font-size: 12px; color: #64748b; margin-top: 2px; }

/* Controls */
.f2-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.f2-controls select, .f2-controls button {
    padding: 7px 14px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 13px; background: #fff; cursor: pointer;
}
.f2-controls button.active { background: var(--f2-primary); color: #fff; border-color: var(--f2-primary); }
.btn-purple { background: var(--f2-purple) !important; color: #fff !important; border-color: var(--f2-purple) !important; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.kpi-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; margin-bottom: 4px; }
.kpi-card .value { font-size: 24px; font-weight: 700; color: #1e293b; }
.kpi-card .sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.kpi-card .ci { font-size: 11px; color: var(--f2-info); font-weight: 500; }
.kpi-card .trend-up { color: var(--f2-success); font-size: 12px; font-weight: 600; }
.kpi-card .trend-down { color: var(--f2-danger); font-size: 12px; font-weight: 600; }
.anomaly-flag { display: inline-block; background: #fef2f2; color: var(--f2-danger); font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; margin-top: 4px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-main { display: grid; grid-template-columns: 1fr 420px; gap: 20px; }

/* Cards */
.panel-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; }
.panel-card h3 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 0 0 14px 0; }

/* Charts */
.chart-box { position: relative; height: 280px; }
.chart-box-sm { position: relative; height: 200px; }
.chart-box-lg { position: relative; height: 360px; }

/* Funnel */
.funnel-container { background: #fff; border-radius: 10px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.funnel-step { display: flex; align-items: stretch; gap: 16px; margin-bottom: 4px; cursor: pointer; transition: transform 0.15s; }
.funnel-step:hover { transform: translateX(4px); }
.funnel-step .level-badge { width: 44px; min-height: 80px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0; }
.funnel-step .step-body { flex: 1; background: #f8fafc; border-radius: 8px; padding: 14px 18px; border: 2px solid transparent; transition: border-color 0.15s; }
.funnel-step.selected .step-body { border-color: var(--f2-primary); background: #eff6ff; }
.funnel-step .step-name { font-weight: 600; font-size: 14px; color: #1e293b; }
.funnel-step .step-stats { display: flex; gap: 20px; margin-top: 6px; flex-wrap: wrap; }
.funnel-step .stat { font-size: 12px; color: #64748b; }
.funnel-step .stat strong { color: #1e293b; font-size: 15px; }
.funnel-step .ci-bar { height: 6px; background: #e2e8f0; border-radius: 3px; margin-top: 8px; position: relative; overflow: hidden; }
.funnel-step .ci-fill { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.funnel-step .ci-point { background: var(--f2-primary); }
.funnel-step .ci-range { background: rgba(32,107,196,0.2); }

/* Drop */
.drop-connector { display: flex; align-items: center; gap: 10px; padding: 4px 0 4px 60px; font-size: 12px; }
.drop-connector .drop-line { width: 2px; height: 24px; background: #e2e8f0; }
.drop-connector .drop-info { color: #64748b; }
.drop-pct { font-weight: 700; }
.drop-pct.significant { color: var(--f2-danger); }
.sig-badge { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: 10px; font-weight: 600; }
.sig-badge.sig { background: #dcfce7; color: #166534; }
.sig-badge.not-sig { background: #f1f5f9; color: #94a3b8; }

/* Tables */
.ab-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ab-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; color: #64748b; font-weight: 600; }
.ab-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.ab-table tr:hover td { background: #f8fafc; }
.pval { font-family: 'SF Mono', monospace; font-size: 11px; }
.pval.sig { color: var(--f2-success); font-weight: 700; }
.pval.not-sig { color: #94a3b8; }

/* Attr bars */
.attr-item { margin-bottom: 12px; }
.attr-item .attr-header { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.attr-item .attr-name { font-weight: 600; color: #1e293b; }
.attr-item .attr-value { color: #64748b; }
.attr-bar { height: 8px; background: #e2e8f0; border-radius: 4px; position: relative; overflow: hidden; }
.attr-bar-fill { height: 100%; border-radius: 4px; }
.attr-bar-ci { position: absolute; top: 0; height: 100%; background: rgba(0,0,0,0.08); border-radius: 4px; }

/* Anomaly */
.anomaly-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px; }
.anomaly-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.anomaly-dot.critical { background: var(--f2-danger); }
.anomaly-dot.warning { background: var(--f2-warning); }
.anomaly-dot.info { background: var(--f2-info); }
.anomaly-text { color: #475569; }
.anomaly-text strong { color: #1e293b; }
.anomaly-time { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* Forecast */
.forecast-label { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: var(--f2-purple); background: #f5f3ff; padding: 2px 8px; border-radius: 8px; }

/* Date range picker */
.date-range-wrap { display: flex; align-items: center; gap: 6px; position: relative; }
.date-range-wrap input[type="date"] {
    padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 12px; font-family: inherit; background: #fff; color: #1e293b; cursor: pointer;
}
.date-range-wrap input[type="date"]:focus { outline: none; border-color: var(--f2-primary); box-shadow: 0 0 0 2px rgba(32,107,196,0.15); }
.date-range-sep { font-size: 11px; color: #94a3b8; }
.date-range-label { font-size: 11px; color: #64748b; font-weight: 500; display: flex; align-items: center; gap: 4px; }
.date-range-label svg { width: 14px; height: 14px; stroke: #64748b; }
.date-preset-btn {
    padding: 6px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 12px; background: #fff; cursor: pointer; font-family: inherit; color: #475569;
    transition: all 0.15s;
}
.date-preset-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.date-preset-btn.active { background: var(--f2-primary); color: #fff; border-color: var(--f2-primary); }

/* Responsive */
@media (max-width: 1200px) { .grid-main, .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .f2-sidebar { display: none; } .f2-main { margin-left: 0; padding: 16px; } }
