:root {
    --sidebar-w: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-fg: #cbd5e1;
    --sidebar-active: #1e293b;
    --accent: #2563eb;
    --bg: #f5f7fb;
    --card: #fff;
}

html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: #1f2937;
}

/* sidebar */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    display: flex; flex-direction: column;
    padding: 20px 0;
    overflow-y: auto;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 20px 18px; }
.logo-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(37,99,235,.2); }
.brand-name { font-weight: 700; color: #f8fafc; font-size: 17px; }
.brand-sub { font-size: 11px; color: #64748b; letter-spacing: .05em; text-transform: uppercase; }
.client-switcher { padding: 0 20px 14px; }
.client-switcher .cs-form { display: flex; gap: 6px; align-items: center; }
.client-switcher .cs-select { flex: 1; }
.client-switcher .cs-edit {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.08); border-radius: 6px;
    color: #cbd5e1; text-decoration: none;
    transition: background .15s;
    flex-shrink: 0;
}
.client-switcher .cs-edit:hover { background: var(--accent); color: #fff; }
.nav-list { flex: 1; display: flex; flex-direction: column; padding: 0 10px; }
.nav-group {
    padding: 14px 12px 6px;
    font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #64748b;
}
.nav-list a {
    display: flex; gap: 10px; align-items: center;
    padding: 8px 12px; border-radius: 8px; color: var(--sidebar-fg);
    text-decoration: none; font-size: 14px; margin: 1px 0;
}
.nav-list a:hover { background: var(--sidebar-active); color: #f8fafc; }
.nav-list a.active { background: var(--accent); color: #fff; }
.sidebar-footer { padding: 18px 20px; border-top: 1px solid #1e293b; margin-top: 10px; }
.user { display: flex; gap: 10px; align-items: center; font-size: 13px; }

/* admin: menu order/visibility editor */
.nav-group-admin {
    padding: 4px 2px 6px;
    font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #94a3b8; font-weight: 600;
}
.menu-sortable .menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; margin: 4px 0;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    cursor: default;
}
.menu-sortable .menu-item.dragging { opacity: .5; border-style: dashed; }
.menu-sortable .grip { cursor: grab; color: #94a3b8; }
.menu-sortable .grip:active { cursor: grabbing; }
.menu-sortable .menu-item-icon { color: #475569; }
.menu-sortable .menu-item-label { flex: 1; font-size: 14px; }
.menu-sortable .menu-item-vis {
    display: inline-flex; align-items: center; gap: 5px;
    margin: 0; padding: 2px 8px; border-radius: 6px; cursor: pointer; color: #94a3b8;
}
.menu-sortable .menu-item-vis:has(input:checked) { color: var(--accent); }
.menu-sortable .menu-item-vis input { cursor: pointer; }

/* main */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 24px;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 10;
}
.topbar-tools { display: flex; gap: 10px; align-items: center; }
.content { padding: 20px 24px; }

/* cards */
.card { border: 0; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04); border-radius: 12px; background: var(--card); }
.card-header { background: transparent; border-bottom: 1px solid #f1f5f9; padding: 14px 18px; font-size: 14px; }
.card-body { padding: 18px; }
.card-footer { background: transparent; border-top: 1px solid #f1f5f9; padding: 14px 18px; }

/* KPIs */
.grid-kpi {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 12px;
}
.kpi { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(15,23,42,.05); display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 12px; color: #64748b; letter-spacing: .06em; text-transform: uppercase; }
.kpi-value { font-size: 22px; font-weight: 700; }
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.kpi-up    { color: #16a34a; }
.kpi-delta.kpi-down  { color: #dc2626; }
.kpi-delta.kpi-flat  { color: #94a3b8; }
.kpi-delta .kpi-prev { color: #94a3b8; font-weight: 400; margin-left: 6px; }
.funnel-svg { width: 100%; height: auto; display: block; }
.topbar-subline { margin-top: 2px; font-size: 12px; }

/* ---------- Funnel 2.0 V4 style ---------- */
.kpi-grid-v4 {
    display: grid; gap: 14px; margin-bottom: 20px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.kpi-v4 {
    background: #fff; border-radius: 10px; padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.kpi-v4 .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; margin-bottom: 6px; }
.kpi-v4 .value { font-size: 22px; font-weight: 700; color: #1e293b; line-height: 1; }
.kpi-v4 .sub   { font-size: 12px; margin-top: 8px; }
.kpi-v4 .prev-label { color: #94a3b8; margin-left: 6px; font-size: 11px; }

.delta-up   { color: #2fb344; font-weight: 700; }
.delta-down { color: #d63939; font-weight: 700; }
.delta-flat { color: #94a3b8; font-weight: 600; }

.v4-main { margin-bottom: 18px; }

.funnel-container-v4 {
    background: #fff; border-radius: 10px; padding: 24px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.funnel-container-v4 .funnel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.funnel-container-v4 .funnel-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: #1e293b; }
.funnel-container-v4 .legend { display: flex; gap: 14px; font-size: 11px; color: #64748b; }
.funnel-container-v4 .legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }

.funnel-step-v4 {
    display: flex; gap: 14px; align-items: stretch;
    transition: transform .12s ease;
    flex-wrap: wrap;
}
.funnel-step-v4:hover { transform: translateX(3px); }
.funnel-step-v4 .step-body { cursor: pointer; }
.funnel-step-v4 .step-body::after {
    content: '▾'; float: right; color: #94a3b8; font-size: 12px;
    transition: transform .2s ease; margin-top: -2px;
}
.funnel-step-v4.is-expanded .step-body::after { transform: rotate(180deg); }

/* Click-to-expand deep-stats panel */
.step-popover {
    flex-basis: 100%;
    margin-left: 58px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 12px;
    padding: 16px 18px;
    color: #e2e8f0;
    box-shadow: 0 4px 18px rgba(2,6,23,.18);
    border-left: 3px solid var(--lvl-color, #206bc4);
    display: none;
    margin-top: 4px;
}
.funnel-step-v4.is-expanded .step-popover { display: block; animation: popoverFade .18s ease; }
@keyframes popoverFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.popover-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

/* Tabs in popover header */
.popover-tabs { display: flex; gap: 4px; margin-left: auto; }
.popover-tabs .ptab {
    background: rgba(148,163,184,.10); color: #cbd5e1;
    border: none; padding: 5px 10px; font-size: 11px; font-weight: 600;
    border-radius: 6px; cursor: pointer; transition: all .15s ease;
    text-transform: uppercase; letter-spacing: .04em;
}
.popover-tabs .ptab:hover { background: rgba(148,163,184,.18); color: #f1f5f9; }
.popover-tabs .ptab.is-active { background: var(--lvl-color, #206bc4); color: #fff; }

.popover-pane { display: none; margin-top: 14px; }
.popover-pane.is-active { display: block; animation: popoverFade .15s ease; }
.pane-empty { padding: 24px 12px; text-align: center; color: #64748b; font-size: 12px; }
.pane-empty code { background: rgba(148,163,184,.15); padding: 2px 6px; border-radius: 4px; color: #e2e8f0; }

/* Breakdown lists (channels, devices) */
.bd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bd-row { display: grid; grid-template-columns: 140px 1fr 160px; gap: 12px; align-items: center; font-size: 12px; }
.bd-name { color: #f1f5f9; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-icon { display: inline-block; width: 18px; }
.bd-bar-wrap { background: rgba(148,163,184,.12); border-radius: 4px; height: 8px; overflow: hidden; }
.bd-bar { height: 100%; border-radius: 4px; transition: width .25s ease; }
.bd-vals { display: flex; gap: 8px; align-items: baseline; justify-content: flex-end; color: #cbd5e1; }
.bd-vals strong { color: #f8fafc; font-size: 13px; }
.bd-vals .bd-pct { color: #94a3b8; font-size: 11px; min-width: 42px; text-align: right; }
.bd-vals .bd-rev { color: #4ade80; font-weight: 600; font-size: 11px; }

/* Heatmap (7 dow × 24 hour) */
.heatmap-wrap { display: flex; flex-direction: column; gap: 2px; font-size: 10px; }
.hm-cols-header, .hm-row { display: grid; grid-template-columns: 32px repeat(24, 1fr); gap: 2px; align-items: center; }
.hm-corner, .hm-day { color: #94a3b8; font-size: 10px; text-align: center; }
.hm-day { font-weight: 600; }
.hm-hour { color: #64748b; font-size: 9px; text-align: center; }
.hm-cell {
    height: 18px; border-radius: 2px; background: rgba(148,163,184,.06);
    border: 1px solid rgba(148,163,184,.06);
    cursor: help; transition: transform .12s ease;
}
.hm-cell:hover { transform: scale(1.4); border-color: rgba(255,255,255,.4); z-index: 1; position: relative; }
.popover-stats { display: flex; flex-direction: column; gap: 10px; }
.popover-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(148,163,184,.15); flex-wrap: wrap; }
.popover-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 12px; }
.popover-title { font-weight: 600; font-size: 14px; color: #f1f5f9; }
.popover-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.popover-stat { display: flex; flex-direction: column; gap: 2px; }
.popover-stat .ps-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; font-weight: 600; }
.popover-stat .ps-value { font-size: 18px; font-weight: 700; color: #f8fafc; line-height: 1.1; }
.popover-stat .ps-sub { font-size: 11px; color: #64748b; }
.popover-stat.danger .ps-value { color: #fca5a5; }
.popover-days { padding-top: 6px; border-top: 1px solid rgba(148,163,184,.15); }
.popover-day { display: flex; gap: 8px; align-items: flex-start; }
.popover-day .ps-arrow { font-size: 12px; line-height: 1.4; }
.popover-day.best .ps-arrow { color: #4ade80; }
.popover-day.worst .ps-arrow { color: #f87171; }
.popover-day .ps-day-val { font-size: 12px; color: #e2e8f0; font-weight: 600; }
.popover-spark { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.popover-spark .ps-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; font-weight: 600; }
.popover-spark-box { flex: 1; min-height: 90px; position: relative; }
.popover-spark-box canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.popover-spark-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #475569; font-size: 11px; font-style: italic; }

@media (max-width: 992px) {
    .popover-grid { grid-template-columns: 1fr; }
    .popover-spark-box { min-height: 70px; }
}
@media (max-width: 640px) {
    .step-popover { margin-left: 0; }
}
.funnel-step-v4 .level-badge {
    width: 44px; min-height: 88px; border-radius: 8px;
    color: #fff; font-weight: 700; font-size: 15px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.funnel-step-v4 .step-body {
    flex: 1; background: #f8fafc; border-radius: 8px; padding: 12px 16px;
    border: 2px solid transparent;
}
.funnel-step-v4 .step-name { font-weight: 600; font-size: 14px; color: #1e293b; }
.funnel-step-v4 .step-stats { display: flex; gap: 18px; margin-top: 6px; flex-wrap: wrap; }
.funnel-step-v4 .stat { font-size: 12px; color: #64748b; }
.funnel-step-v4 .stat strong { color: #1e293b; font-size: 14px; margin: 0 4px; }
.funnel-step-v4 .ci-label { color: #0ea5e9; font-size: 10px; margin-left: 4px; }
.funnel-step-v4 .step-prev { min-width: 100px; line-height: 1.4; }

.ci-bar-v4 { position: relative; height: 10px; background: #e2e8f0; border-radius: 5px; margin-top: 10px; overflow: visible; }
.ci-bar-v4 .ci-fill { position: absolute; top: 0; left: 0; height: 100%; background: var(--lvl-color, #206bc4); border-radius: 5px; transition: width .25s ease; }
.ci-bar-v4 .ci-point { position: absolute; top: -3px; width: 3px; height: 16px; background: var(--lvl-color, #206bc4); border-radius: 2px; box-shadow: 0 0 0 2px #fff; }

.drop-connector-v4 { display: flex; align-items: center; gap: 12px; padding: 4px 0 4px 60px; font-size: 12px; }
.drop-connector-v4 .drop-line { width: 2px; height: 24px; background: #e2e8f0; }
.drop-connector-v4 .drop-info { color: #64748b; }
.drop-connector-v4 .drop-pct { font-weight: 700; color: #94a3b8; }
.drop-connector-v4 .drop-pct.significant { color: #d63939; }

.ch-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

/* Conversion paths */
.paths-list { }
.path-row {
    padding: 14px 18px; border-bottom: 1px solid #f1f5f9;
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap;
}
.path-row:last-child { border-bottom: 0; }
.path-row:hover { background: #f8fafc; }
.path-chain {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    flex: 1; min-width: 0;
}
.path-chip {
    display: inline-block;
    color: #fff; font-weight: 600; font-size: 12px;
    padding: 5px 10px; border-radius: 6px;
    white-space: nowrap;
}
.path-arrow { color: #cbd5e1; font-size: 14px; font-weight: 700; }
.path-purchase {
    background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0;
    padding: 5px 10px; border-radius: 6px; font-size: 12px;
}
.path-stats {
    display: flex; gap: 14px; font-size: 13px; color: #1e293b;
    min-width: 200px; justify-content: flex-end;
}
.assist-table th { font-size: 11px; text-transform: uppercase; color: #64748b; letter-spacing: .05em; }
.assist-table td { font-size: 13px; }

/* Refresh overlay */
.refresh-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(3px);
}
.refresh-card {
    background: #fff; border-radius: 14px; padding: 32px 40px;
    min-width: 320px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.refresh-spinner {
    width: 48px; height: 48px; margin: 0 auto 16px;
    border: 4px solid #e2e8f0; border-top-color: #2563eb;
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.refresh-title { font-weight: 700; font-size: 16px; color: #0f172a; }
.refresh-sub   { color: #64748b; font-size: 13px; margin-top: 6px; }

.v4-side { display: flex; flex-direction: column; gap: 16px; }
.panel-card-v4 { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.panel-card-v4 h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: #1e293b; }

/* Chart container — fixes Chart.js maintainAspectRatio:false collapsing to 0px */
.chart-box { position: relative; height: 280px; }
.chart-box-sm { position: relative; height: 200px; }
.chart-box-lg { position: relative; height: 360px; }

/* Scissors decay checkpoints */
.decay-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.decay-card {
    border-radius: 10px; padding: 14px 16px;
    border-left: 4px solid #94a3b8;
    background: #f8fafc;
    display: flex; flex-direction: column; gap: 8px;
}
.decay-head { display: flex; justify-content: space-between; align-items: baseline; }
.decay-t { font-weight: 700; font-size: 14px; color: #0f172a; }
.decay-sub { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.decay-val { font-size: 24px; font-weight: 800; line-height: 1; }
.decay-bar { height: 6px; background: rgba(148,163,184,.25); border-radius: 3px; overflow: hidden; }
.decay-fill { height: 100%; border-radius: 3px; transition: width .3s ease; }
.decay-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.decay-foot .badge { font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 4px; }

/* ---------- Live Events Bar (MA style) ---------- */
.live-bar {
    background: #fff; border-radius: 12px; border-left: 4px solid #2fb344;
    padding: 14px 18px; margin-bottom: 16px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 22px;
    box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #2fb344; display: inline-block; animation: live-pulse 2s infinite; }
@keyframes live-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.live-label { font-weight: 600; }
.live-metric { display: flex; flex-direction: column; gap: 2px; }
.live-metric span { color: #94a3b8; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.live-metric b { font-weight: 700; font-size: 15px; }
.live-updated { color: #94a3b8; font-size: 12px; }

/* ---------- KPI MA-style ---------- */
.kpi-ma {
    background: #fff; border-radius: 10px; padding: 14px 16px;
    border-left: 4px solid #94a3b8;
    box-shadow: 0 1px 3px rgba(15,23,42,.05);
    height: 100%; display: flex; flex-direction: column; gap: 2px;
}
.kpi-ma .kpi-label { font-size: 11px; color: #64748b; letter-spacing: .06em; text-transform: uppercase; }
.kpi-ma .kpi-value { font-size: 20px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.kpi-ma .kpi-delta { font-size: 11px; font-weight: 600; margin-top: 4px; }
.kpi-ma .kpi-prev  { color: #94a3b8; font-weight: 400; margin-left: 6px; font-size: 10px; }
.kpi-ma.kpi-sessions  { border-left-color: #206bc4; }
.kpi-ma.kpi-users     { border-left-color: #0ea5e9; }
.kpi-ma.kpi-cvr       { border-left-color: #2fb344; }
.kpi-ma.kpi-revenue   { border-left-color: #f76707; }
.kpi-ma.kpi-purchases { border-left-color: #a855f7; }
.kpi-ma.kpi-aov       { border-left-color: #eab308; }

/* ---------- Funnel 2.0 step cards with dashed connector ---------- */
.funnel-step {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15,23,42,.05);
    padding: 14px 18px;
    display: flex; align-items: center; gap: 16px;
    cursor: default;
    transition: transform .1s ease, box-shadow .1s ease;
}
.funnel-step:hover { transform: translateX(2px); box-shadow: 0 3px 10px rgba(15,23,42,.08); }
.funnel-step .fs-badge {
    font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
    background: rgba(32,107,196,.1); color: #206bc4;
    padding: 3px 8px; border-radius: 4px; font-weight: 700;
}
.funnel-step .fs-title { font-weight: 700; font-size: 18px; color: #0f172a; margin-top: 6px; }
.funnel-step .fs-users { font-size: 28px; font-weight: 800; line-height: 1; color: #0f172a; text-align: right; }
.funnel-step .fs-revenue { color: #64748b; font-size: 12px; text-align: right; margin-top: 4px; }
.funnel-step .fs-trend {
    display: inline-block; margin-left: 8px; font-size: 10px; font-weight: 700;
    padding: 2px 6px; border-radius: 4px;
}
.fs-trend.up   { background: rgba(47,179,68,.15); color: #2fb344; }
.fs-trend.down { background: rgba(214,57,57,.15); color: #d63939; }
.fs-trend.flat { background: rgba(148,163,184,.15); color: #94a3b8; }

/* dashed connector between steps */
.funnel-connector {
    position: relative;
    margin-left: 40px;
    padding: 10px 0 10px 26px;
    border-left: 2px dashed #cbd5e1;
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.funnel-connector .badge-conv { background: rgba(47,179,68,.15); color: #2fb344; font-weight: 700; padding: 5px 10px; border-radius: 6px; font-size: 12px; }
.funnel-connector .badge-drop { background: rgba(214,57,57,.15); color: #d63939; font-weight: 700; padding: 5px 10px; border-radius: 6px; font-size: 12px; }

/* ---------- Attribution ranking list ---------- */
.rank-list .rank-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; border-bottom: 1px solid #f1f5f9;
}
.rank-list .rank-item:last-child { border-bottom: 0; }
.rank-list .rank-pos {
    width: 24px; height: 24px; border-radius: 50%; background: #f1f5f9;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; margin-right: 10px; color: #64748b;
}
.rank-list .rank-pos-1 { background: #fef3c7; color: #b45309; }
.rank-list .rank-pos-2 { background: #e5e7eb; color: #374151; }
.rank-list .rank-pos-3 { background: #fed7aa; color: #9a3412; }

.grid-live {
    display: grid; gap: 10px;
    grid-template-columns: repeat(3, 1fr);
}
.grid-live > div {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 12px; background: #f8fafc; border-radius: 8px;
}
.grid-live span { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .08em; }
.grid-live b { font-size: 17px; }

/* cohort matrix */
.cohort-table td { font-size: 12px; padding: 6px; }
.cohort-cell { min-width: 54px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.2); }

/* severity */
.severity-high td { background: rgba(239, 68, 68, .06); }
.severity-medium td { background: rgba(245, 158, 11, .05); }

/* login */
.login-bg { background: linear-gradient(135deg, #1e293b, #0f172a); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 16px; padding: 36px; width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }

/* responsive */
@media (max-width: 900px) {
    .sidebar { position: relative; width: 100%; height: auto; flex-direction: column; }
    .main { margin-left: 0; }
    .nav-list { flex-direction: row; flex-wrap: wrap; }
    .nav-list a { flex: 1 1 auto; }
}

/* ---------- Conversion window control (topbar slider + modal) ---------- */
.conv-window-control {
    display: inline-flex; align-items: center; gap: 8px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 4px 10px; font-size: 12px;
}
.conv-window-control label {
    color: #64748b; font-weight: 500; margin: 0;
    text-transform: uppercase; letter-spacing: .06em; font-size: 10px;
}
.conv-window-control input[type="range"] {
    width: 110px; accent-color: #206bc4; cursor: pointer; vertical-align: middle;
}
.conv-window-control [data-cw-label] {
    font-weight: 600; color: #0f172a; min-width: 42px; text-align: right;
    font-variant-numeric: tabular-nums;
}
.conv-window-control .cw-help {
    color: #94a3b8; cursor: help;
}

.cw-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.cw-modal-card {
    background: #fff; border-radius: 12px; padding: 24px 28px;
    width: 100%; max-width: 460px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.cw-modal-title { margin: 0 0 8px; font-weight: 600; color: #0f172a; }
.cw-modal-body  { color: #475569; margin: 0 0 18px; font-size: 14px; }
.cw-modal-actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px;
}
.cw-modal-progress { margin: 16px 0 8px; }
.cw-modal-status { font-family: ui-monospace, SFMono-Regular, monospace; }
