/* ════════════════════════════════════════════════════════════════
   Revenue Lab — Event Dashboard · Design System
   Ported from Claude Design (app.jsx, charts.jsx, Revenue Lab.html)
   Palette: #8B5CF6 (violet) · #34D399 (green) · #F87171 (red) · #FBBF24 (amber)
   ════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg:          #0C0A14;
    --panel:       rgba(255,255,255,0.03);
    --panel-glass: linear-gradient(135deg, rgba(139,92,246,0.08) 0%, rgba(30,27,46,0.95) 100%);
    --panel-alt:   #1E1B2E;
    --border:      rgba(255,255,255,0.06);
    --border-vio:  rgba(139,92,246,0.15);

    --text:        #F9FAFB;
    --text-2:      #E5E7EB;
    --text-3:      #D1D5DB;
    --text-sec:    #9CA3AF;
    --text-muted:  #6B7280;

    --violet:      #8B5CF6;
    --violet-2:    #A78BFA;
    --violet-3:    #C4B5FD;
    --violet-deep: #6D28D9;
    --green:       #34D399;
    --red:         #F87171;
    --amber:       #FBBF24;

    --grid:        rgba(255,255,255,0.06);
    --radius:      16px;
    --ease:        cubic-bezier(0.16, 1, 0.3, 1);

    --font: 'SF Pro Display', 'Inter', -apple-system, BlinkMacSystemFont,
            'Segoe UI', 'Helvetica Neue', sans-serif;
}

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

html {
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg);
    color: var(--text);
}
body { overflow-x: hidden; background: var(--bg); }

/* Subtle ambient background glow */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(139,92,246,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(109,40,217,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 90%, rgba(52,211,153,0.02) 0%, transparent 45%);
    pointer-events: none;
    z-index: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.45); }

/* ── Keyframes ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse  { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes glow   { 0%,100% { box-shadow: 0 0 8px rgba(139,92,246,0.2); } 50% { box-shadow: 0 0 20px rgba(139,92,246,0.4); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes progress-slide { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes skeleton-pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 0.85; } }

/* ════════════════════════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════════════════════════ */
.app {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    position: relative;
    z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 240px;
    background: linear-gradient(180deg, #13102A 0%, #0C0A14 100%);
    border-right: 1px solid rgba(139,92,246,0.10);
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.logo { padding: 28px 24px 24px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.logo-text { font-size: 20px; letter-spacing: -0.3px; color: var(--text); }
.logo-text .thin { font-weight: 300; }
.logo-text .bold { font-weight: 700; margin-left: 6px; }
.logo-sub {
    font-size: 11px; color: var(--text-sec); margin-top: 4px;
    letter-spacing: 1.5px; text-transform: uppercase;
}
.nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px; cursor: pointer;
    font-size: 14px; font-weight: 400; color: var(--text-sec);
    background: transparent; border: 1px solid transparent;
    transition: all 0.3s var(--ease);
    user-select: none;
}
.nav-item:hover { background: rgba(139,92,246,0.06); color: var(--text-2); }
.nav-item.active {
    font-weight: 600; color: var(--text);
    background: rgba(139,92,246,0.12);
    border: 1px solid rgba(139,92,246,0.20);
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.footer-info {
    padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 11px; color: var(--text-sec);
}
.footer-time {
    font-size: 15px; font-weight: 600; color: var(--text);
    font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
}

/* ── (?) hover glossary chips for jargon (WD, ROS, GM ROI, NS Uplift, …) ── */
.metric-glossary {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin: 4px 0 14px; font-size: 11px;
}
.metric-term {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 9px; border-radius: 8px;
    background: rgba(139,92,246,0.06);
    border: 1px solid rgba(139,92,246,0.16);
    color: var(--text-2); font-weight: 600;
    letter-spacing: 0.2px; white-space: nowrap;
}
.metric-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 50%;
    background: rgba(139,92,246,0.28);
    color: #F9FAFB;
    font-size: 10px; font-weight: 700; cursor: help;
    position: relative; font-style: normal;
}
.metric-help:hover {
    background: var(--violet);
}
.metric-help[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px); left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(15,12,30,0.98);
    border: 1px solid rgba(139,92,246,0.45);
    color: var(--text);
    padding: 10px 14px; border-radius: 10px;
    font-size: 12px; font-weight: 400; line-height: 1.45;
    width: 320px; max-width: 360px;
    white-space: normal; text-align: left;
    box-shadow: 0 14px 36px rgba(0,0,0,0.45);
    z-index: 1000;
    pointer-events: none;
    opacity: 0; visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.metric-help[data-tooltip]::after {
    content: '';
    position: absolute; bottom: calc(100% + 4px);
    left: 50%; transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(139,92,246,0.45);
    opacity: 0; visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    pointer-events: none;
}
.metric-help[data-tooltip]:hover::before,
.metric-help[data-tooltip]:hover::after {
    opacity: 1; visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ── Main content ── */
.main { margin-left: 240px; padding: 24px 32px; min-height: 100vh; }
.header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 28px; padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.header-title { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.header-sub { font-size: 13px; color: var(--text-sec); margin-top: 4px; }
.header-meta { display: flex; align-items: center; gap: 20px; }
.header-time { font-size: 13px; color: var(--text-sec); }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--green);
    box-shadow: 0 0 8px rgba(52,211,153,0.5);
    animation: pulse 2s ease infinite;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6, #6D28D9);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; color: #fff;
}
.period-switch {
    display: flex; gap: 2px; padding: 3px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}
.period-pill {
    padding: 7px 16px; border-radius: 8px; font-size: 12px;
    font-weight: 600; color: var(--text-sec); cursor: pointer;
    user-select: none; transition: all 0.2s;
    border: 1px solid transparent;
}
.period-pill:hover { color: var(--text-2); }
.period-pill.active {
    color: var(--text);
    background: rgba(139,92,246,0.22);
    border-color: rgba(139,92,246,0.36);
}
/* Pricing dynamics: clear-selection button next to SKU chips */
.chip-toolbar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px; flex-wrap: wrap;
}
.chip-toolbar .chip-wrap { margin-bottom: 0; flex: 1; }
.btn-clear {
    padding: 6px 12px; font-size: 11px; font-weight: 600;
    color: var(--text-sec);
    background: rgba(248,113,113,0.10);
    border: 1px solid rgba(248,113,113,0.25);
    border-radius: 8px; cursor: pointer; transition: all 0.2s;
    white-space: nowrap;
}
.btn-clear:hover { color: var(--text); background: rgba(248,113,113,0.18); }
.tab-pane { animation: fadeUp 0.45s ease; }

/* ════════════════════════════════════════════════════════════════
   PANELS / SECTIONS  (glassmorphism)
   ════════════════════════════════════════════════════════════════ */
.section, .panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    padding: 24px;
    /* NB: deliberately no backdrop-filter — it makes the section a containing
       block for position:fixed children, and Safari then anchors the open
       Dropdown menu to the section instead of the viewport. */
}
.panel { padding: 20px; }
.section-title {
    font-size: 15px; font-weight: 600; color: var(--text-2);
    margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--violet); flex-shrink: 0; }
.dot.green { background: var(--green); }
.dot.red   { background: var(--red); }
.dot.amber { background: var(--amber); }

.row { display: flex; gap: 16px; margin-bottom: 16px; }
.row > .panel, .row > .section { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-14 { margin-top: 14px; }
.mt-12 { margin-top: 12px; }

/* ════════════════════════════════════════════════════════════════
   KPI CARDS
   ════════════════════════════════════════════════════════════════ */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi-card {
    background: linear-gradient(135deg, rgba(139,92,246,0.08) 0%, rgba(30,27,46,0.95) 100%);
    border: 1px solid rgba(139,92,246,0.15);
    border-radius: var(--radius);
    padding: 24px 28px;
    flex: 1 1 0; min-width: 180px;
    animation: fadeUp 0.6s var(--ease) both;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(139,92,246,0.12); }
.kpi-label {
    font-size: 13px; color: var(--text-sec); font-weight: 500;
    letter-spacing: 0.5px; margin-bottom: 8px; text-transform: uppercase;
}
.kpi-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; font-weight: 600; margin-top: 10px; display: flex; align-items: center; gap: 4px; }
.kpi-sub.up   { color: var(--green); }
.kpi-sub.down { color: var(--red); }

/* ════════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════════ */
.tbl-header {
    display: grid; padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 12px; color: var(--text-sec); font-weight: 500;
}
.tbl-row {
    display: grid; padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 13px; color: var(--text-2); align-items: center;
    transition: background 0.2s;
}
.tbl-row:hover { background: rgba(139,92,246,0.06); }
.tbl-row.selected { background: rgba(139,92,246,0.10); }
.tbl-row.clickable { cursor: pointer; }
.t-right  { text-align: right; }
.t-center { text-align: center; }
.tabnum   { font-variant-numeric: tabular-nums; }
.muted    { color: var(--text-sec); }
.bold     { font-weight: 600; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ── Channel performance tiles ── */
.ch-tile {
    background: rgba(139,92,246,0.06);
    border-radius: 12px; padding: 16px; text-align: center;
    transition: all 0.3s var(--ease);
}
.ch-tile:hover { background: rgba(139,92,246,0.12); transform: translateY(-2px); }
.ch-name { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.ch-val  { font-size: 22px; font-weight: 700; color: var(--text); }
.ch-meta { font-size: 12px; color: var(--text-sec); margin-top: 4px; }

/* ── Chart legends ── */
.legend-row { display: flex; gap: 24px; margin-top: 12px; justify-content: center; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sec); }
.legend-swatch { width: 12px; height: 3px; border-radius: 2px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════
   INSIGHT CARDS (AI)
   ════════════════════════════════════════════════════════════════ */
.insight {
    padding: 16px 18px; border-radius: 12px; margin-bottom: 10px;
    border: 1px solid; transition: all 0.3s; animation: fadeUp 0.5s ease both;
}
.insight.opportunity { background: rgba(52,211,153,0.07); border-color: rgba(52,211,153,0.18); }
.insight.alert       { background: rgba(248,113,113,0.07); border-color: rgba(248,113,113,0.18); }
.insight.trend       { background: rgba(139,92,246,0.07); border-color: rgba(139,92,246,0.18); }
.insight:hover { transform: translateY(-2px); }
.insight-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.badge {
    font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.badge.opportunity { color: var(--green); background: rgba(52,211,153,0.12); }
.badge.alert       { color: var(--red);   background: rgba(248,113,113,0.12); }
.badge.trend       { color: var(--violet-2); background: rgba(139,92,246,0.12); }
.insight-conf { font-size: 11px; }
.insight-conf.opportunity { color: var(--green); }
.insight-conf.alert       { color: var(--red); }
.insight-conf.trend       { color: var(--violet-2); }
.insight-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.insight-text  { font-size: 12px; color: var(--text-3); line-height: 1.55; }

/* ════════════════════════════════════════════════════════════════
   SUB-TABS (RGM)
   ════════════════════════════════════════════════════════════════ */
.subtab-bar {
    display: flex; gap: 4px; padding: 4px; background: rgba(255,255,255,0.04);
    border-radius: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.subtab {
    padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 600;
    cursor: pointer; color: var(--text-sec);
    background: transparent; border: 1px solid transparent;
    transition: all 0.3s; user-select: none;
}
.subtab:hover { color: var(--text-2); background: rgba(139,92,246,0.06); }
.subtab.active {
    color: var(--text); background: rgba(139,92,246,0.20);
    border: 1px solid rgba(139,92,246,0.30);
}

/* ── Promo cards ── */
.promo-card { padding: 14px 16px; border-radius: 12px; margin-bottom: 8px; border: 1px solid; }
.promo-card.good { background: rgba(52,211,153,0.06); border-color: rgba(52,211,153,0.15); }
.promo-card.bad  { background: rgba(248,113,113,0.06); border-color: rgba(248,113,113,0.15); }
.promo-roi-badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px; }
.promo-roi-badge.good { color: var(--green); background: rgba(52,211,153,0.15); }
.promo-roi-badge.bad  { color: var(--red);   background: rgba(248,113,113,0.15); }
.mini-bar { margin-top: 8px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.06); overflow: hidden; display: flex; }

/* ── Leak bars ── */
.leak-track { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.06); overflow: hidden; }
.leak-fill  { height: 100%; background: linear-gradient(90deg, #F87171, #EF4444); border-radius: 4px; transition: width 1s ease; }

/* ── Recommendation box ── */
.rec-box { margin-top: 16px; padding: 14px; border-radius: 10px; }
.rec-box.violet { background: rgba(139,92,246,0.06); border: 1px solid rgba(139,92,246,0.10); }
.rec-box.green  { background: rgba(52,211,153,0.06); border: 1px solid rgba(52,211,153,0.10); }
.rec-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.rec-text  { font-size: 12px; color: var(--text-3); line-height: 1.5; }

/* ════════════════════════════════════════════════════════════════
   OBPPC MATRIX
   ════════════════════════════════════════════════════════════════ */
.obb-grid { display: grid; grid-template-columns: 160px repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.obb-grid-4 .obb-cell { min-height: 92px; }    /* a touch more breathing room when only 2 occasion rows */
.obb-col-head { text-align: center; font-size: 12px; color: var(--text-sec); font-weight: 500; white-space: pre-line; }
.obb-row-head { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; }
.obb-cell {
    min-height: 80px; border-radius: 10px; padding: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: all 0.3s; text-align: center;
}
.obb-cell.empty   { background: rgba(255,255,255,0.02); border: 1px dashed rgba(255,255,255,0.10); }
.obb-cell.high    { background: rgba(52,211,153,0.10); border: 1px solid rgba(52,211,153,0.25); }
.obb-cell.mid     { background: rgba(139,92,246,0.10); border: 1px solid rgba(139,92,246,0.20); }
.obb-cell:hover:not(.empty) { transform: scale(1.03); }
.obb-sku  { font-size: 12px; font-weight: 600; color: var(--text); }
.obb-meta { font-size: 11px; color: var(--text-sec); margin-top: 2px; }
.obb-perf { font-size: 10px; font-weight: 600; margin-top: 3px; }
.obb-perf.high { color: var(--green); }
.obb-perf.mid  { color: var(--amber); }
.obb-empty-txt { font-size: 11px; color: rgba(255,255,255,0.20); font-style: italic; }
.gap-card { padding: 14px 16px; background: rgba(251,191,36,0.06); border: 1px solid rgba(251,191,36,0.15); border-radius: 10px; }
.gap-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.gap-tier  { font-size: 12px; color: var(--amber); }
.gap-pot   { font-size: 11px; color: var(--text-sec); margin-top: 6px; }

/* ════════════════════════════════════════════════════════════════
   SKU × CHANNEL HEATMAP
   ════════════════════════════════════════════════════════════════ */
.heat-grid { display: grid; grid-template-columns: 180px repeat(5, 1fr); gap: 6px; margin-bottom: 6px; }
.heat-col-head { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 8px 4px; }
.heat-col-cost { font-size: 10px; color: var(--text-sec); margin-top: 2px; }
.heat-row-head { font-size: 12px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; padding: 0 8px; }
.heat-cell { border-radius: 8px; padding: 8px 6px; text-align: center; transition: all 0.3s; border: 1px solid; }
.heat-cell:hover { transform: scale(1.05); }
.heat-cell.high { background: rgba(52,211,153,0.15); border-color: rgba(52,211,153,0.25); }
.heat-cell.mid  { background: rgba(139,92,246,0.12); border-color: rgba(139,92,246,0.20); }
.heat-cell.low  { background: rgba(248,113,113,0.10); border-color: rgba(248,113,113,0.20); }
.heat-share { font-size: 13px; font-weight: 700; }
.heat-share.high { color: var(--green); }
.heat-share.mid  { color: var(--violet-2); }
.heat-share.low  { color: var(--red); }
.heat-eff { font-size: 10px; color: var(--text-sec); margin-top: 2px; }
.combo-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px; }

/* ════════════════════════════════════════════════════════════════
   CHIPS (SKU selector — pricing)
   ════════════════════════════════════════════════════════════════ */
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
    padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 500; cursor: pointer;
    color: var(--text-sec); background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08); transition: all 0.2s; user-select: none;
}
.chip:hover { border-color: rgba(139,92,246,0.4); color: var(--text-2); }
.chip.active {
    color: var(--text); background: rgba(139,92,246,0.20);
    border: 1px solid rgba(139,92,246,0.40);
}

/* ════════════════════════════════════════════════════════════════
   ELASTICITY SIMULATOR
   ════════════════════════════════════════════════════════════════ */
.sim-hero {
    background: linear-gradient(135deg, rgba(139,92,246,0.12) 0%, rgba(30,27,46,0.95) 100%);
    border: 1px solid rgba(139,92,246,0.15);
    border-radius: var(--radius); padding: 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    flex-wrap: wrap;
}
.sim-hero-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.sim-hero-sub   { font-size: 13px; color: var(--text-sec); }
.sim-slider-wrap { display: flex; align-items: center; gap: 20px; min-width: 320px; }
.sim-pct { font-size: 28px; font-weight: 700; color: var(--violet); min-width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
.sim-tbl-head {
    display: grid; grid-template-columns: 1.8fr 0.6fr 0.7fr 0.7fr 0.8fr 0.8fr;
    padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 11px; color: var(--text-sec); font-weight: 500; gap: 6px;
}
.sim-tbl-row {
    display: grid; grid-template-columns: 1.8fr 0.6fr 0.7fr 0.7fr 0.8fr 0.8fr;
    padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px; color: var(--text-2); align-items: center; gap: 6px;
    transition: background 0.2s;
}
.sim-tbl-row:hover { background: rgba(139,92,246,0.08); }
.sim-total-box { margin-top: 16px; padding: 14px; border-radius: 10px; border: 1px solid; }
.sim-total-box.pos { background: rgba(52,211,153,0.06); border-color: rgba(52,211,153,0.15); }
.sim-total-box.neg { background: rgba(248,113,113,0.06); border-color: rgba(248,113,113,0.15); }

/* ════════════════════════════════════════════════════════════════
   CSV TESTER
   ════════════════════════════════════════════════════════════════ */
.csv-drop {
    width: 100%; max-width: 560px; padding: 56px 40px; text-align: center; cursor: pointer;
    border: 2px dashed rgba(139,92,246,0.3); border-radius: 24px;
    background: rgba(139,92,246,0.04); transition: all 0.4s var(--ease);
}
.csv-drop:hover { border-color: rgba(139,92,246,0.6); background: rgba(139,92,246,0.08); transform: translateY(-2px); }
.csv-drop-icon { font-size: 46px; margin-bottom: 16px; color: var(--violet); font-weight: 300; }
.csv-drop-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.csv-drop-sub { font-size: 14px; color: var(--text-sec); line-height: 1.6; }
.csv-drop-btn {
    margin-top: 24px; padding: 12px 32px; background: var(--violet); border-radius: 10px;
    color: #fff; font-size: 14px; font-weight: 600; display: inline-block;
    box-shadow: 0 4px 16px rgba(139,92,246,0.35);
}
.csv-hint { margin-top: 24px; font-size: 13px; color: var(--text-sec); text-align: center; }

/* Progress bar */
.progress-track { height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; border: 1px solid rgba(255,255,255,0.06); }
.progress-indeterminate {
    height: 6px; border-radius: 3px; width: 100%;
    background: linear-gradient(90deg, transparent, #8B5CF6, #34D399, transparent);
    background-size: 200% 100%;
    animation: progress-slide 1.6s ease-in-out infinite;
}
.pulse-text { animation: pulse 1.6s ease infinite; }

/* Skeleton placeholders */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(139,92,246,0.10) 37%, rgba(255,255,255,0.04) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: 8px;
}

/* AI markdown */
.ai-markdown { color: var(--text-3); font-size: 13px; line-height: 1.6; }
.ai-markdown h1, .ai-markdown h2, .ai-markdown h3 { color: var(--text); margin: 12px 0 6px; }
.ai-markdown strong { color: var(--violet-2); font-weight: 700; }
.ai-markdown ul { padding-left: 20px; margin: 6px 0; }
.ai-markdown li { margin-bottom: 4px; }
.ai-markdown p { margin-bottom: 8px; }
.ai-markdown code { background: rgba(139,92,246,0.12); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Success banner */
.banner-success {
    background: linear-gradient(135deg, rgba(52,211,153,0.10) 0%, rgba(30,27,46,0.95) 100%);
    border: 1px solid rgba(52,211,153,0.20); border-radius: var(--radius);
    padding: 20px 24px; display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

/* ════════════════════════════════════════════════════════════════
   FORM CONTROLS — buttons, inputs, sliders, dropdowns
   ════════════════════════════════════════════════════════════════ */
.btn-primary {
    padding: 12px 28px; background: var(--violet); border: none; border-radius: 10px;
    color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.3s; box-shadow: 0 4px 16px rgba(139,92,246,0.30);
}
.btn-primary:hover { background: #7C3AED; transform: translateY(-1px); }
.btn-ghost {
    padding: 10px 20px; background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
    color: var(--text-2); font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.14); }

/* ── Dash 4 number inputs (per-SKU adjustment box) ── */
.sim-input.dash-input-container {
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 6px !important; width: 64px !important; padding: 0 !important;
}
.sim-input.dash-input-container:focus-within {
    border-color: rgba(139,92,246,0.55) !important;
    box-shadow: 0 0 0 2px rgba(139,92,246,0.15) !important;
}
.sim-input .dash-input-element {
    background: transparent !important; color: var(--text) !important;
    text-align: center; font-size: 13px; font-variant-numeric: tabular-nums;
    border: none !important; box-shadow: none !important;
}
/* hide Dash's clear/stepper button so the box stays compact */
.sim-input .dash-input-stepper, .sim-input button { display: none !important; }

/* ── Dash 4 Slider (dash-slider-* / dash-range-slider-*) — violet theme ── */
.dash-slider-track { background: rgba(139,92,246,0.20) !important; }
.dash-slider-range { background: var(--violet) !important; }
.dash-slider-thumb {
    background: var(--violet) !important; border: 2px solid var(--violet-3) !important;
    box-shadow: 0 0 10px rgba(139,92,246,0.5) !important;
}
.dash-slider-thumb:hover, .dash-slider-thumb:focus {
    box-shadow: 0 0 14px rgba(139,92,246,0.7) !important; outline: none !important;
}
.dash-slider-mark { color: var(--text-muted) !important; font-size: 10px !important; }
.dash-slider-tooltip {
    background: var(--panel-alt) !important; color: var(--text) !important;
    border: 1px solid rgba(139,92,246,0.4) !important;
}
/* slider's editable numeric box */
input.dash-range-slider-input {
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    color: var(--text) !important; border-radius: 6px !important;
    text-align: center; font-variant-numeric: tabular-nums;
}

/* ── dcc.Dropdown dark theme (mapping editor) ── */
.Select-control, .Select.is-focused > .Select-control,
.is-focused:not(.is-open) > .Select-control {
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    color: var(--text) !important; border-radius: 8px !important; box-shadow: none !important;
}
.Select-value-label, .Select-placeholder, .Select--single > .Select-control .Select-value {
    color: var(--text) !important;
}
.Select-menu-outer {
    background: var(--panel-alt) !important;
    border: 1px solid rgba(139,92,246,0.3) !important; border-radius: 8px !important;
    z-index: 1000 !important;
}
.Select-option { background: var(--panel-alt) !important; color: var(--text-2) !important; font-size: 12px; }
.Select-option.is-focused { background: rgba(139,92,246,0.18) !important; color: var(--text) !important; }
.Select-option.is-selected { background: rgba(139,92,246,0.30) !important; }
.Select-arrow { border-color: var(--text-sec) transparent transparent !important; }
.Select-input > input { color: var(--text) !important; }
/* Newer dash-core dropdown (react-select v2+) fallbacks */
.dash-dropdown .Select-control { background: rgba(255,255,255,0.06) !important; }

/* ── Dash 4 dcc.Dropdown (dash-dropdown-*) — dark theme + positioning ──
   The open menu must anchor directly under the trigger. Dash defaults to
   position:fixed with viewport-calculated coords; any ancestor with
   backdrop-filter / transform / filter turns into a containing block and
   the menu lands in the wrong place. We pin it explicitly. */
.dash-dropdown-wrapper, .dash-dropdown {
    position: relative !important;
    overflow: visible !important;        /* never clip the menu */
}
/* Dash 4 wraps the dropdown in a <button>; browsers render those with a solid
   white background by default. Reset to transparent so the inner trigger span
   (`.dash-dropdown-grid-container`) provides the actual dark glass surface. */
button.dash-dropdown {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
    color: inherit !important;
    font: inherit !important;
    text-align: left !important;
    cursor: pointer;
}
button.dash-dropdown:focus, button.dash-dropdown:focus-visible {
    outline: none !important;
}
.dash-dropdown-content {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto auto auto 0 !important;   /* nuke any inset shorthand */
    transform: none !important;            /* override any inline transform */
    margin: 0 !important;
    min-width: 100% !important;
    width: max-content;
    max-width: 360px;
    max-height: 320px;
    z-index: 9999 !important;
}
.dash-options-list { max-height: 240px !important; overflow-y: auto !important; }
.dash-dropdown-grid-container {
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 8px !important; color: var(--text) !important;
}
.dash-dropdown-grid-container:hover { border-color: rgba(139,92,246,0.4) !important; }
.dash-dropdown-value, .dash-dropdown-value-item, .dash-dropdown-value-item span,
.dash-dropdown-placeholder { color: var(--text) !important; }
.dash-dropdown-trigger svg { color: var(--text-sec) !important; stroke: var(--text-sec) !important; }
.dash-dropdown-content {
    background: var(--panel-alt) !important;
    border: 1px solid rgba(139,92,246,0.3) !important; border-radius: 8px !important;
}
.dash-dropdown-search {
    background: rgba(255,255,255,0.06) !important; color: var(--text) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}
.dash-options-list, .dash-dropdown-options { background: var(--panel-alt) !important; }
.dash-dropdown-option, .dash-options-list-option {
    color: var(--text-2) !important; background: transparent !important; font-size: 12px;
}
.dash-dropdown-option:hover, .dash-options-list-option:hover {
    background: rgba(139,92,246,0.18) !important; color: var(--text) !important;
}
.dash-options-list-option.selected, .dash-dropdown-option.selected {
    background: rgba(139,92,246,0.16) !important; color: var(--text) !important;
}
/* multi-select chrome (search / Select All / checkboxes) — muted, not garish */
.dash-dropdown-search-container, .dash-dropdown-actions {
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}
.dash-dropdown-actions { padding: 6px 10px !important; display: flex; gap: 14px; }
.dash-dropdown-action-button {
    color: var(--text-sec) !important; background: transparent !important; border: none !important;
    font-size: 11px !important; font-weight: 600 !important; padding: 2px 0 !important;
    cursor: pointer; text-transform: none !important; box-shadow: none !important;
}
.dash-dropdown-action-button:hover { color: var(--violet-2) !important; }
.dash-options-list-option { border-radius: 6px !important; margin: 1px 4px !important; }
.dash-options-list-option:hover, .dash-dropdown-option:hover {
    background: rgba(139,92,246,0.10) !important;
}
.dash-options-list-option-checkbox {
    accent-color: #8B5CF6 !important; width: 13px !important; height: 13px !important;
}
.dash-dropdown-content svg { color: var(--text-muted) !important; stroke: var(--text-muted) !important; }

/* Dash _dash-loading + loading dots inherit accent via component props */

/* ════════════════════════════════════════════════════════════════
   LAYOUT UTILITIES
   ════════════════════════════════════════════════════════════════ */
/* Plotly graphs report a 700px intrinsic width; without min-width:0 the grid/flex
   tracks refuse to shrink below it and the page overflows horizontally. */
.grid-2 > *, .grid-3 > *, .grid-4 > *, .kpi-row > *,
.row > *, .col > *, .sim-grid > *, .wf-grid > *, .pricing-grid > * { min-width: 0; }
.spark-cell { display: flex; justify-content: flex-end; overflow: hidden; }
.spark-cell .js-plotly-plot { width: 90px !important; }

.col { display: flex; flex-direction: column; gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-40 { gap: 40px; }
.gap-32 { gap: 32px; }
.gap-24 { gap: 24px; }
.gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.full-min { min-height: 520px; }

.pricing-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
.sim-grid     { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 16px; }
.wf-grid      { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.donut-wrap   { display: flex; align-items: center; justify-content: center; gap: 40px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; }
.legend-line  { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }

.csv-stage-center {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 480px;
}
.csv-preview-cell { padding: 7px 6px; background: rgba(255,255,255,0.02); color: var(--text-3); font-size: 11px; white-space: nowrap; border-bottom: 1px solid rgba(255,255,255,0.03); }
.csv-preview-head { padding: 8px 6px; background: rgba(139,92,246,0.08); color: var(--violet-2); font-weight: 600; font-size: 10px; white-space: nowrap; }

@media (max-width: 1100px) {
    .pricing-grid, .sim-grid, .wf-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════
   PROMO performance dashboard — slide 11 (2×2 quadrant KPI panels)
   ════════════════════════════════════════════════════════════════ */
.promo-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.promo-panel {
    border-radius: 14px; overflow: hidden;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.promo-panel:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.promo-panel-head {
    padding: 12px 18px; font-size: 13px; font-weight: 700;
    letter-spacing: 0.4px; text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.promo-panel.neutral .promo-panel-head { background: rgba(255,255,255,0.06); color: var(--text-2); }
.promo-panel.good    .promo-panel-head { background: rgba(52,211,153,0.18);  color: #34D399; border-bottom-color: rgba(52,211,153,0.28); }
.promo-panel.bad     .promo-panel-head { background: rgba(248,113,113,0.18); color: #F87171; border-bottom-color: rgba(248,113,113,0.28); }
.promo-panel.warn    .promo-panel-head { background: rgba(251,191,36,0.18);  color: #FBBF24; border-bottom-color: rgba(251,191,36,0.28); }
.promo-panel-body { padding: 4px 18px 12px; }
.promo-panel-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 13px;
}
.promo-panel-row:last-child { border-bottom: none; }
.promo-panel-row .pp-label { color: var(--text-sec); }
.promo-panel-row .pp-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.promo-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-sec); }
.promo-meta-item { display: flex; align-items: center; gap: 6px; }
.promo-meta-item b { color: var(--text-2); font-weight: 600; }

@media (max-width: 1100px) { .promo-panels { grid-template-columns: 1fr; } }

/* ════════════════════════════════════════════════════════════════
   MIX view (RGM › Mix) — slide 7: NS/kg strip
   ════════════════════════════════════════════════════════════════ */
.ns-strip-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 4px 12px; flex-wrap: wrap; gap: 12px;
}
.ns-strip-label {
    font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: 0.3px;
    display: flex; align-items: center; gap: 8px;
}
.ns-legend {
    display: flex; align-items: center; gap: 14px; font-size: 11px;
    color: var(--text-sec); flex-wrap: wrap;
}
.ns-legend-item { display: flex; align-items: center; gap: 6px; }
.ns-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.ns-dot.ns-high_acc { background: #34D399; }
.ns-dot.ns-acc      { background: #6EE7B7; }
.ns-dot.ns-dil      { background: #FBBF24; }
.ns-dot.ns-high_dil { background: #F87171; }
.ns-avg { color: var(--text-muted); margin-left: auto; }
.ns-strip {
    display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; padding: 2px;
}
.ns-cell {
    padding: 10px 4px; border-radius: 6px; text-align: center;
    border: 1px solid; transition: transform 0.2s; cursor: default;
}
.ns-cell:hover { transform: translateY(-2px); }
.ns-val { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ns-name { font-size: 9px; color: var(--text-sec); margin-top: 3px; line-height: 1.2;
           white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ns-cell.ns-high_acc { background: rgba(52,211,153,0.24);  border-color: rgba(52,211,153,0.55); }
.ns-cell.ns-high_acc .ns-val { color: #34D399; }
.ns-cell.ns-acc      { background: rgba(110,231,183,0.16); border-color: rgba(110,231,183,0.40); }
.ns-cell.ns-acc      .ns-val { color: #6EE7B7; }
.ns-cell.ns-dil      { background: rgba(251,191,36,0.22);  border-color: rgba(251,191,36,0.55); }
.ns-cell.ns-dil      .ns-val { color: #FBBF24; }
.ns-cell.ns-high_dil { background: rgba(248,113,113,0.22); border-color: rgba(248,113,113,0.55); }
.ns-cell.ns-high_dil .ns-val { color: #F87171; }
@media (max-width: 1100px) { .ns-strip { grid-template-columns: repeat(6, 1fr); } }

/* Soft glow behind Mix-view plots so bars and sunburst feel rounded, not flat. */
#rgm-view-channel .js-plotly-plot .plot-container {
    filter: drop-shadow(0 6px 24px rgba(139,92,246,0.10));
}
/* Sunburst sectors — pull edges in a touch and round caps where possible */
#rgm-view-channel g.slice path { stroke-linejoin: round; }

/* ════════════════════════════════════════════════════════════════
   PRICE view (RGM › Price) — slides 3-4
   ════════════════════════════════════════════════════════════════ */
.price-grid { display: grid; grid-template-columns: 264px 1fr; gap: 16px; }
.price-filters {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px; padding: 18px; align-self: start;
}
.pf-title {
    font-size: 12px; font-weight: 700; color: var(--violet-2);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.pf-label {
    font-size: 10px; color: var(--text-muted); font-weight: 600;
    letter-spacing: 0.4px; margin: 12px 0 4px; text-transform: uppercase;
}
.pf-dd { font-size: 12px; }
.pf-seg-btn {
    padding: 6px 10px; border-radius: 8px; font-size: 11px; font-weight: 600;
    cursor: pointer; color: var(--text-sec); background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08); transition: all 0.2s;
}
.pf-seg-btn.active { color: var(--text); background: rgba(139,92,246,0.2); border-color: rgba(139,92,246,0.4); }
.price-pills { display: flex; gap: 4px; background: rgba(255,255,255,0.04); border-radius: 10px; padding: 3px; }
.price-pill {
    padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
    color: var(--text-sec); cursor: pointer; transition: all 0.2s;
}
.price-pill.active { background: rgba(139,92,246,0.2); color: var(--text); border: 1px solid rgba(139,92,246,0.3); }
.drill-btn {
    padding: 6px 14px; border-radius: 8px; font-size: 12px; color: var(--text-sec);
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); cursor: pointer;
}
.bubble-note { font-size: 11px; color: var(--text-sec); text-align: center; margin-top: 8px; }
@media (max-width: 1100px) { .price-grid { grid-template-columns: 1fr; } }

/* ── Responsive ── */
@media (max-width: 1100px) {
    .grid-4, .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .sidebar { width: 64px; }
    .logo-text, .logo-sub, .nav-item span:not(.nav-icon), .footer-info { display: none; }
    .main { margin-left: 64px; padding: 16px; }
    .grid-2, .grid-4, .kpi-row { grid-template-columns: 1fr; }
}
