
/* ═══════════════════════════════════════════
   1. DESIGN TOKENS — Dark Theme (matching course)
   ═══════════════════════════════════════════ */
:root {
    --font: 'Rubik', sans-serif;

    --bg: #0b1120;
    --bg-subtle: #111827;
    --surface: #1a2332;
    --surface-hover: #1e293b;
    --surface-active: #243244;

    --primary: #14b8a6;
    --primary-hover: #0d9488;
    --primary-light: #2dd4bf;
    --primary-bg: rgba(20,184,166,0.1);
    --primary-dark: #0f766e;
    --primary-glow: rgba(20,184,166,0.25);

    --accent: #F59E0B;
    --accent-bg: rgba(245,158,11,0.1);

    --success: #10b981;
    --success-bg: rgba(16,185,129,0.1);
    --success-light: #34d399;

    --danger: #ef4444;
    --danger-bg: rgba(239,68,68,0.1);
    --danger-light: #f87171;

    --warning: #f59e0b;
    --warning-bg: rgba(245,158,11,0.1);

    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --border: #1e3a5f;
    --border-hover: #2d4a6f;

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 9999px;

    --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
    --shadow-sm: 0 2px 8px rgba(15,23,42,0.06);
    --shadow-md: 0 4px 16px rgba(15,23,42,0.08);
    --shadow-lg: 0 8px 32px rgba(15,23,42,0.1);
    --shadow-xl: 0 16px 48px rgba(15,23,42,0.14);

    --topbar-h: 60px;
    --gauge-arc: 282.743; /* π × 90 */
}

/* ═══ LIGHT MODE ═══ */
[data-theme="light"] {
    --bg: #f8fafc;
    --bg-subtle: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --surface-active: #f1f5f9;

    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: #14b8a6;
    --primary-bg: rgba(13,148,136,0.08);
    --primary-dark: #115e59;
    --primary-glow: rgba(13,148,136,0.15);

    --accent: #d97706;
    --accent-bg: rgba(217,119,6,0.08);

    --success: #059669;
    --success-bg: rgba(5,150,105,0.08);
    --success-light: #10b981;

    --danger: #dc2626;
    --danger-bg: rgba(220,38,38,0.06);
    --danger-light: #ef4444;

    --warning: #d97706;
    --warning-bg: rgba(217,119,6,0.06);

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;

    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.1);
}

/* ═══════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
    padding-top: var(--topbar-h);
    -webkit-font-smoothing: antialiased;
}
input, button, select, textarea { font-family: var(--font); color: var(--text); }
input, select, textarea { background: var(--bg); }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }

/* ═══════════════════════════════════════════
   3. TOPBAR
   ═══════════════════════════════════════════ */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: rgba(11,17,32,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 999;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    transition: box-shadow .3s;
}
body.scrolled .topbar { box-shadow: var(--shadow-sm); }
.topbar-right { display:flex; align-items:center; gap:12px; min-width:0; }
.topbar-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 16px;
    flex-shrink: 0;
}
.topbar-company {
    font-weight: 600; font-size: 15px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 200px;
}
.course-nav-logo {
    display: flex; align-items: center; gap: 0.6rem;
    text-decoration: none; color: #b3e0dc;
    font-family: 'Rubik', sans-serif; font-weight: 700; font-size: 1.1rem;
}
.course-nav-logo img {
    height: 38px; width: 38px; object-fit: contain;
    border-radius: 10px; background: rgba(179,224,220,0.12);
    padding: 4px; flex-shrink: 0;
}
.topbar-center {
    display: flex; align-items: center; gap: 12px;
    opacity: 0; transform: translateY(-4px);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}
body.scrolled .topbar-center { opacity: 1; transform: translateY(0); pointer-events: auto; }
.topbar-mini-gauge { width: 36px; height: 36px; }
.topbar-mini-gauge svg { width: 100%; height: 100%; display: block; }
.topbar-score {
    font-size: 18px; font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    min-width: 44px; text-align: center;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.btn-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    transition: background .2s, color .2s;
}
.btn-icon:hover { background: var(--surface-active); color: var(--primary); }
.btn-icon svg { width: 18px; height: 18px; }

.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand-name {
    font-size: 15px; font-weight: 700;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), #14b8a6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.4px;
    direction: ltr;
    white-space: nowrap;
}
.topbar-sep {
    width: 1px; height: 20px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 2px;
}

/* ═══════════════════════════════════════════
   4. LAYOUT
   ═══════════════════════════════════════════ */
.app { max-width: 1260px; margin: 0 auto; padding: 24px 20px 60px; }

.hero {
    text-align: center; padding: 32px 0 8px;
    animation: fadeUp .6s ease-out;
}
.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), #14b8a6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.hero p { color: var(--text-secondary); font-size: 1.05rem; font-weight: 400; }

.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 24px;
}
@media (min-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr 340px;
        align-items: start;
    }
    .dashboard-side {
        position: sticky; top: calc(var(--topbar-h) + 16px);
    }
}

/* ═══════════════════════════════════════════
   5. INPUT SECTION
   ═══════════════════════════════════════════ */
.input-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 16px;
    animation: fadeUp .6s ease-out .1s both;
}
.input-card > input[type="text"],
.input-card .ai-autofill-wrapper input[type="text"] {
    width: 100%; padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1.1rem; font-weight: 500;
    transition: border-color .2s, box-shadow .2s;
    background: var(--bg);
    color: var(--text);
}
.input-card > input[type="text"]:focus,
.input-card .ai-autofill-wrapper input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: var(--surface);
    color: var(--text);
}
.input-card > input[type="text"]::placeholder,
.input-card .ai-autofill-wrapper input[type="text"]::placeholder { color: var(--text-muted); font-weight: 400; }

.controls-row {
    display: flex; flex-wrap: wrap; gap: 12px;
    align-items: center; justify-content: space-between;
}

.mode-tabs {
    display: inline-flex;
    background: var(--bg);
    border-radius: var(--radius-pill);
    padding: 4px;
    gap: 2px;
}
.mode-tab {
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    font-size: 14px; font-weight: 500;
    color: var(--text-secondary);
    transition: all .25s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.toolbar {
    display: flex; flex-wrap: wrap; gap: 6px;
    align-items: stretch;
}
.toolbar-group {
    display: flex; align-items: center; gap: 5px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
}
.toolbar-sep {
    width: 0; height: 0; margin: 0;
}
.tool-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    transition: all .2s;
    white-space: nowrap;
    cursor: pointer;
    font-family: var(--font);
}
.tool-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.tool-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.tool-btn.primary { background: var(--primary-bg); color: var(--primary); border-color: rgba(13,148,136,0.15); }
.tool-btn.primary:hover { background: var(--primary); color: white; }
.tool-btn.danger { color: var(--danger); }
.tool-btn.danger:hover { background: var(--danger-bg); }
.tool-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Overflow dropdown */
.toolbar-overflow {
    position: relative;
}
.toolbar-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    z-index: 100;
}
.toolbar-overflow.open .toolbar-dropdown { display: block; }
.toolbar-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 10px 12px;
    font-size: 13px; font-weight: 500;
    color: var(--text-secondary);
    background: none; border: none; border-radius: var(--radius-sm);
    cursor: pointer; transition: all .15s;
    font-family: var(--font);
    text-align: right;
}
.toolbar-dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.toolbar-dropdown-item:hover { background: var(--bg); color: var(--text); }
.toolbar-dropdown-item.danger { color: var(--danger); }
.toolbar-dropdown-item.danger:hover { background: var(--danger-bg); }
.toolbar-dropdown-sep {
    height: 1px; background: var(--border); margin: 4px 8px;
}

@media (max-width: 640px) {
    .toolbar { gap: 4px; }
    .tool-btn span:not(.ai-pro-badge) { display: none; }
    .tool-btn { padding: 7px 9px; }
    .toolbar-group { gap: 3px; padding: 3px; }
}

.advanced-toggle {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-secondary);
    padding-top: 4px;
}
.toggle-switch {
    position: relative; width: 40px; height: 22px;
    background: var(--border); border-radius: 11px;
    cursor: pointer; transition: background .3s;
    flex-shrink: 0;
}
.toggle-switch.active { background: var(--primary); }
.toggle-switch::after {
    content: '';
    position: absolute; top: 3px; right: 3px;
    width: 16px; height: 16px;
    background: #94a3b8; border-radius: 50%;
    box-shadow: var(--shadow-xs);
    transition: transform .3s;
}
.toggle-switch.active::after { transform: translateX(-18px); }

/* ═══════════════════════════════════════════
   6. PROGRESS BAR
   ═══════════════════════════════════════════ */
.progress-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    animation: fadeUp .6s ease-out .15s both;
}
.progress-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.progress-head h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.progress-head span { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.progress-track {
    height: 8px; background: var(--bg);
    border-radius: 4px; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--primary), #14b8a6);
    border-radius: 4px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ═══════════════════════════════════════════
   7. CATEGORIES
   ═══════════════════════════════════════════ */
.category { margin-bottom: 20px; }
.category-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all .2s;
    user-select: none;
}
.category-head:hover { border-color: var(--primary-light); box-shadow: var(--shadow-xs); }
.cat-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.cat-icon.profit { background: rgba(37,99,235,0.15); color: #60a5fa; }
.cat-icon.growth { background: rgba(16,185,129,0.15); color: #34d399; }
.cat-icon.value  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.cat-icon.stable { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.cat-icon.custom { background: rgba(139,92,246,0.15); color: #a78bfa; }
.cat-title { flex:1; font-weight: 600; font-size: 15px; color: var(--text); }
.cat-badge {
    font-size: 12px; font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg);
    color: var(--text-secondary);
}
.cat-chevron {
    width: 20px; height: 20px;
    color: var(--text-muted);
    transition: transform .3s;
    flex-shrink: 0;
}
.cat-chevron.collapsed { transform: rotate(-90deg); }

.category-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 12px;
    padding: 4px 2px;
    max-height: 3000px;
    overflow: hidden;
    opacity: 1;
    transition: max-height .4s ease, opacity .3s ease, margin-top .4s ease;
}
.category-body.collapsed {
    max-height: 0; opacity: 0; margin-top: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   8. METRIC CARDS
   ═══════════════════════════════════════════ */
.metric-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    display: flex; flex-direction: column; gap: 12px;
    transition: transform .25s, box-shadow .25s, border-color .25s;
    position: relative;
    animation: fadeUp .4s ease-out both;
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}
.metric-head {
    display: flex; justify-content: space-between; align-items: flex-start;
}
.metric-head h3 {
    font-size: 14px; font-weight: 600; color: var(--text);
    line-height: 1.4;
}
.info-btn {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--primary);
    background: var(--primary-bg);
    border: 1px solid rgba(20,184,166,0.2);
    transition: all .2s; flex-shrink: 0;
    cursor: pointer;
}
.info-btn:hover { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 2px 8px rgba(20,184,166,0.3); }
.metric-desc {
    font-size: 12.5px; color: var(--text-secondary);
    line-height: 1.5; margin-top: -4px;
}
.metric-input-area { display: flex; flex-direction: column; gap: 8px; }
.metric-input-row {
    display: flex; align-items: center; gap: 8px;
}
.metric-input-row label {
    font-size: 13px; color: var(--text-secondary);
    min-width: 55px; flex-shrink: 0;
}
.metric-input-row input[type="number"] {
    flex: 1; padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 500;
    direction: ltr; text-align: left;
    transition: all .2s;
    background: var(--bg);
    color: var(--text);
    min-width: 0;
}
.metric-input-row input[type="number"]:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
    color: var(--text);
}
.metric-input-row input[type="number"].pass {
    border-color: var(--success); background: var(--success-bg);
}
.metric-input-row input[type="number"].fail {
    border-color: var(--danger); background: var(--danger-bg);
}
.metric-input-row .unit {
    font-size: 13px; color: var(--text-muted); font-weight: 500;
    flex-shrink: 0;
}
@keyframes inputHighlight {
    from { background: var(--primary-light); }
    to { background: var(--bg); }
}
.input-highlighted { animation: inputHighlight .8s ease-out; }

.metric-bar-row {
    display: flex; align-items: center; gap: 10px;
}
.metric-bar {
    flex: 1; height: 6px;
    background: var(--bg-subtle);
    border-radius: 3px; overflow: hidden;
}
.metric-bar-fill {
    height: 100%; width: 0%;
    border-radius: 3px;
    background: var(--text-muted);
    transition: width .5s cubic-bezier(.4,0,.2,1), background .3s;
}
.metric-bar-score {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    min-width: 32px; text-align: left; direction: ltr;
}

.metric-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 4px;
    border-top: 1px solid var(--bg-subtle);
}
.metric-threshold {
    font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.metric-threshold .custom-tag {
    color: var(--warning); font-size: 10px; margin-right: 4px;
}
.metric-status {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    transition: all .3s;
}
.metric-status.pass {
    background: var(--success-bg); color: var(--success);
}
.metric-status.fail {
    background: var(--danger-bg); color: var(--danger);
}
.metric-status.neutral {
    background: var(--bg); color: var(--text-muted);
}

/* Custom threshold (advanced mode) */
.custom-threshold {
    display: none;
    align-items: center; gap: 8px;
    padding: 8px 10px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--primary-light);
    font-size: 12px;
}
.custom-threshold.visible { display: flex; }
.custom-threshold label { color: var(--primary); font-weight: 500; white-space: nowrap; }
.custom-threshold input {
    width: 65px; padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px; direction: ltr; text-align: left;
}
.custom-threshold input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.custom-threshold button {
    color: var(--primary); padding: 2px;
    font-size: 16px; line-height: 1;
}
.custom-threshold button:hover { color: var(--primary-dark); }

/* Delete btn for custom metrics */
.delete-metric-btn {
    position: absolute; top: 10px; left: 10px;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--danger); opacity: 0;
    transition: opacity .2s, background .2s;
    font-size: 15px;
}
.metric-card:hover .delete-metric-btn { opacity: 1; }
.delete-metric-btn:hover { background: var(--danger-bg); }

/* ═══════════════════════════════════════════
   9. SCORE PANEL (Sidebar)
   ═══════════════════════════════════════════ */
.score-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; align-items: center;
    gap: 16px;
    animation: fadeUp .6s ease-out .2s both;
}
.score-card-title {
    font-size: 16px; font-weight: 700; color: var(--text);
    letter-spacing: -0.3px;
}
.gauge-wrap {
    width: 100%; max-width: 260px;
    position: relative;
}
.gauge-svg { width: 100%; height: auto; display: block; }
.gauge-svg .gauge-track {
    fill: none; stroke: var(--bg-subtle); stroke-width: 16;
    stroke-linecap: round;
}
.gauge-svg .gauge-progress {
    fill: none; stroke-width: 16; stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1), stroke .5s;
}
.gauge-svg .gauge-score-text {
    font-family: var(--font);
    font-size: 52px; font-weight: 800;
    fill: var(--text);
    transition: fill .5s;
}
.gauge-svg .gauge-percent-text {
    font-family: var(--font);
    font-size: 20px; font-weight: 400;
    fill: var(--text-muted);
}
.gauge-svg .gauge-label-text {
    font-family: var(--font);
    font-size: 16px; font-weight: 600;
    transition: fill .5s;
}

.score-status {
    font-size: 14px; color: var(--text-secondary);
    text-align: center; min-height: 2.5em; line-height: 1.5;
}
.score-criteria {
    font-size: 13px; font-weight: 500;
    background: var(--bg);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    text-align: center;
    width: 100%;
}

/* Radar */
.radar-wrap {
    width: 100%; margin-top: 8px;
}
.radar-title {
    font-size: 14px; font-weight: 600; color: var(--text);
    text-align: center; margin-bottom: 8px;
}
.radar-svg-container {
    width: 100%; height: 200px; position: relative;
}
.radar-svg-container svg { width: 100%; height: 100%; }
.radar-legend {
    display: flex; justify-content: center; gap: 16px;
    margin-top: 8px;
}
.radar-legend-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-secondary);
}
.legend-dot {
    width: 10px; height: 10px; border-radius: 3px;
}
.legend-dot.threshold { background: var(--primary-bg); border: 1px dashed var(--primary); }
.legend-dot.value { background: rgba(20,184,166,0.6); border: 1px solid var(--primary); }

.score-actions {
    display: flex; flex-direction: column; gap: 8px;
    width: 100%; margin-top: 8px;
}
.score-btn {
    width: 100%; padding: 11px 18px;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all .2s;
}
.score-btn svg { width: 16px; height: 16px; }
.score-btn.primary {
    background: var(--primary); color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.score-btn.primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px var(--primary-glow); }
.score-btn.secondary {
    background: var(--bg); color: var(--text-secondary);
    border: 1px solid var(--border);
}
.score-btn.secondary:hover { background: var(--surface-active); color: var(--text); }

/* ═══════════════════════════════════════════
   10. NOTES
   ═══════════════════════════════════════════ */
.notes-section {
    margin-top: 24px;
    animation: fadeUp .6s ease-out .3s both;
}
.notes-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.notes-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.notes-card textarea {
    width: 100%; min-height: 90px; padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px; resize: vertical;
    background: var(--bg);
    transition: border-color .2s, box-shadow .2s;
}
.notes-card textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

/* ── Disclaimer ── */
.disclaimer-section { margin-top: 16px; }
.disclaimer-card {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.disclaimer-card p {
    font-size: 11px; line-height: 1.6;
    color: var(--text-muted);
}
.disclaimer-card strong {
    color: var(--text-secondary); font-weight: 600;
}

/* ═══════════════════════════════════════════
   11. MODALS
   ═══════════════════════════════════════════ */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1100;
    align-items: center; justify-content: center;
    opacity: 0; transition: opacity .25s;
}
.modal-overlay.open { display: flex; opacity: 1; }
.modal-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 92%; max-width: 700px; max-height: 88vh;
    overflow-y: auto; position: relative;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    transform: scale(.96) translateY(8px);
    transition: transform .3s;
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }
.modal-close {
    position: absolute; top: 16px; left: 16px;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--text-muted);
    transition: all .2s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-header {
    text-align: center; margin-bottom: 20px;
    padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-size: 1.3rem; font-weight: 700; margin-bottom: 4px;
    word-wrap: break-word;
}
.modal-header p { font-size: 14px; color: var(--text-secondary); }

/* Tab system */
.modal-tabs {
    display: flex; border-bottom: 2px solid var(--border);
    margin-bottom: 20px; overflow-x: auto; gap: 0;
}
.modal-tab {
    padding: 10px 18px;
    font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all .2s;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Term items */
/* ── Metric Encyclopedia Grid ── */
.terms-grid { }
.terms-cat-label {
    font-size: 13px; font-weight: 700;
    color: var(--text-secondary);
    margin: 16px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.terms-cat-label:first-child { margin-top: 0; }
.terms-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}
.terms-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: all .2s;
    display: flex; flex-direction: column; gap: 6px;
}
.terms-card:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.terms-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.terms-card-name {
    font-size: 13px; font-weight: 600; color: var(--text);
}
.terms-card-score {
    font-size: 12px; font-weight: 700;
}
.terms-card-desc {
    font-size: 11px; color: var(--text-muted); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.terms-card-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: auto; padding-top: 6px;
}
.terms-card-threshold {
    font-size: 10px; color: var(--text-muted); font-weight: 500;
}
.terms-card-action {
    font-size: 10px; color: var(--primary); font-weight: 600;
}
@media (max-width: 640px) {
    .terms-cat-grid { grid-template-columns: 1fr; }
}

/* Template metrics */
.template-btns {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.template-btn {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px; font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    transition: all .2s;
}
.template-btn:hover { color: var(--text); background: var(--surface-active); }
.template-btn.active { background: var(--primary); color: white; }
.template-desc {
    font-size: 13px; color: var(--text-secondary); line-height: 1.6;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.template-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px; max-height: 300px; overflow-y: auto; padding: 4px;
}
.template-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.template-item-name { font-size: 12.5px; font-weight: 500; color: var(--text); }
.template-item-val { font-size: 13px; font-weight: 600; color: var(--primary); direction: ltr; }

/* Summary metrics */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.summary-item {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.summary-item-name { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.summary-item-value {
    font-size: 14px; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 6px;
}

/* History list */
.history-list { max-height: 400px; overflow-y: auto; }
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 8px;
    border-bottom: 1px solid var(--bg);
    transition: background .2s;
}
.history-item:hover { background: var(--surface-hover); }
.history-name { font-weight: 600; font-size: 14px; }
.history-date { font-size: 12px; color: var(--text-muted); }
.history-actions { display: flex; gap: 8px; }
.history-actions button { font-size: 12px; }
.no-history { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* Custom metric form */
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary);
}
.form-group input[type="number"] { direction: ltr; text-align: left; }
.form-group textarea { min-height: 60px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-weights { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.form-weights .form-group { flex: 1; min-width: 70px; margin-bottom: 0; }

/* ═══════════════════════════════════════════
   12. TOAST
   ═══════════════════════════════════════════ */
.toast-container {
    position: fixed; bottom: 20px; left: 20px;
    z-index: 10000;
    display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px; font-weight: 500;
    color: white;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 8px;
    min-width: 220px; max-width: 340px;
    opacity: 0; transform: translateX(-100%);
    transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--text); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ═══════════════════════════════════════════
   12.32 DEEP-DIVE TABS FIX & ENHANCEMENTS
   ═══════════════════════════════════════════ */

/* Primary tabs styling handled in section 12.34 and main fix section */

/* ═══════════════════════════════════════════
   12.33 DUAL COMPANY COMPARISON MODE
   ═══════════════════════════════════════════ */
.company-tabs-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-bg) 0%, rgba(20,184,166,0.12) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    border: 1px solid var(--primary-light);
}
.company-tabs-bar.active {
    display: flex;
}
.company-tab {
    flex: 1;
    max-width: 280px;
    padding: 10px 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all .2s;
}
.company-tab:hover {
    border-color: var(--primary-light);
}
.company-tab.active {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.company-tab .ct-icon {
    width: 32px;
    height: 32px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.company-tab.active .ct-icon {
    background: var(--primary);
    color: white;
}
.company-tab .ct-info { flex: 1; min-width: 0; }
.company-tab .ct-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.company-tab .ct-score {
    font-size: 11px;
    color: var(--text-muted);
}
.company-tab .ct-edit {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    transition: all .2s;
}
.company-tab .ct-edit:hover {
    background: var(--bg);
    color: var(--text);
}
.company-add-btn {
    padding: 10px 16px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
}
.company-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}
.company-compare-toggle {
    margin-right: auto;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
}
.company-compare-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.company-compare-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ═══════════════════════════════════════════
   12.34 INFOGRAPHICS GALLERY MODAL
   ═══════════════════════════════════════════ */
.infographics-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1300;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}
.infographics-modal.open { display: flex; }
.infographics-container {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 1100px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.infographics-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--surface) 100%);
}
.infographics-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.infographics-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-muted);
    transition: all .2s;
}
.infographics-close:hover {
    background: var(--bg);
    color: var(--text);
}
.infographics-body {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    max-height: 75vh;
    overflow-y: auto;
}
.infographic-card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}
.infographic-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ═══════════════════════════════════════════
   12.35 AI PROMPT MODAL
   ═══════════════════════════════════════════ */
.ai-prompt-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1300;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ai-prompt-modal.open { display: flex; }
.ai-prompt-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}
.ai-prompt-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(245,158,11,0.12) 0%, rgba(245,158,11,0.08) 100%);
}
.ai-prompt-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-prompt-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fbbf24;
    transition: all .2s;
}
.ai-prompt-close:hover { background: rgba(0,0,0,0.05); }
.ai-prompt-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.ai-prompt-intro {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.ai-prompt-intro strong { color: var(--text); }
.ai-prompt-textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    resize: vertical;
    direction: ltr;
    text-align: left;
    background: #1E1B4B;
    color: rgba(20,184,166,0.12);
}
.ai-prompt-textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.ai-prompt-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg);
}
.ai-prompt-footer .apf-hint {
    font-size: 11px;
    color: var(--text-muted);
}
.ai-prompt-copy-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all .2s;
}
.ai-prompt-copy-btn:hover {
    background: var(--primary-hover);
}

/* ═══════════════════════════════════════════
   12.36 COMPARISON VIEW
   ═══════════════════════════════════════════ */
.comparison-view {
    display: none;
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}
.comparison-view.visible { display: block; }
.comparison-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.comparison-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.comparison-close {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all .2s;
}
.comparison-close:hover {
    background: var(--bg);
    color: var(--text);
}
.comparison-grid {
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.comparison-grid > div {
    padding: 12px 16px;
    background: var(--surface);
}
.cg-header {
    background: var(--bg) !important;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}
.cg-metric {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.cg-value {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}
.cg-value.better {
    color: var(--success);
    background: var(--success-bg) !important;
}
.cg-value.worse {
    color: var(--danger);
    background: var(--danger-bg) !important;
}
.cg-value.equal {
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   POLISHED COMPARE VIEW
   ═══════════════════════════════════════════ */
.compare-view {
    display: none;
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    animation: fadeSlideDown .3s ease;
}
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.compare-view-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.compare-view-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.compare-view-close {
    padding: 8px 16px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 12px; font-weight: 500; color: var(--text-secondary);
    cursor: pointer; transition: all .2s; font-family: var(--font);
}
.compare-view-close:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

/* Compare grid — 4 columns: metric | company1 | company2 | winner */
.compare-grid {
    display: grid;
    grid-template-columns: minmax(120px, 1.3fr) 1fr 1fr 50px;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    font-size: 13px;
    margin-bottom: 20px;
}
.cmp-cell {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
}
.cmp-header {
    background: var(--bg);
    font-weight: 700; font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 8px 12px;
}
.cmp-center { justify-content: center; text-align: center; }
.cmp-metric {
    font-size: 12px; font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
}
/* Winner = bold, slightly larger. Loser = muted. */
.cmp-better {
    font-weight: 700 !important;
    color: var(--text) !important;
    font-size: 14px;
}
.cmp-worse {
    color: var(--text-muted) !important;
    font-size: 12px;
}
/* Winner indicator: colored arrow pointing to winner column */
.cmp-winner-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    font-size: 11px; font-weight: 700;
}
.cmp-winner-dot.c1 { background: var(--primary-bg); color: var(--primary); }
.cmp-winner-dot.c1::after { content: '←'; }
.cmp-winner-dot.c2 { background: #ede9fe; color: #7c3aed; }
.cmp-winner-dot.c2::after { content: '→'; }
[data-theme="dark"] .cmp-winner-dot.c2,
.dark .cmp-winner-dot.c2 { background: rgba(124,58,237,0.15); }
.cmp-tie { color: var(--text-muted); font-size: 10px; }

/* Alternating row backgrounds for readability */
.compare-grid .cmp-cell:nth-child(8n+5),
.compare-grid .cmp-cell:nth-child(8n+6),
.compare-grid .cmp-cell:nth-child(8n+7),
.compare-grid .cmp-cell:nth-child(8n+8) {
    background: var(--bg);
}
.compare-grid .cmp-metric:nth-child(8n+5),
.compare-grid .cmp-metric:nth-child(8n+6),
.compare-grid .cmp-metric:nth-child(8n+7),
.compare-grid .cmp-metric:nth-child(8n+8) {
    background: color-mix(in srgb, var(--bg) 80%, var(--surface));
}

/* Summary cards */
.compare-summary {
    display: flex; align-items: stretch; gap: 12px;
}
.cmp-summary-card {
    flex: 1; background: var(--bg);
    border-radius: var(--radius-lg); padding: 20px;
    text-align: center;
    border: 2px solid transparent;
    transition: all .3s;
}
.cmp-summary-card.cmp-winner {
    border-color: var(--primary);
    background: var(--primary-bg);
}
.cmp-summary-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.cmp-summary-score {
    font-size: 32px; font-weight: 900;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    line-height: 1;
}
.cmp-summary-detail {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 10px;
}
.cmp-wins-badge {
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 12px;
}
.cmp-wins-badge.good { background: var(--primary-bg); color: var(--primary); }
.cmp-wins-badge.bad { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.cmp-vs {
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800;
    color: var(--text-muted); padding: 0 2px;
}

/* Compare action button */
.compare-action-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white; border: none;
    border-radius: var(--radius-md);
    font-weight: 600; font-size: 13px;
    font-family: var(--font);
    cursor: pointer; transition: all .2s; white-space: nowrap;
}
.compare-action-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

@media (max-width: 768px) {
    .compare-grid { grid-template-columns: minmax(90px, 1fr) 1fr 1fr 36px; font-size: 11px; }
    .cmp-cell { padding: 8px 6px; }
    .compare-summary { flex-direction: column; }
    .cmp-vs { transform: rotate(90deg); padding: 4px 0; }
}

/* ═══════════════════════════════════════════
   12.37 TOOLBAR ENHANCEMENTS
   ═══════════════════════════════════════════ */
.toolbar-section {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.toolbar-btn {
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    cursor: pointer;
}
.toolbar-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}
.toolbar-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.toolbar-divider {
    width: 1px;
    background: var(--border);
    margin: 0 4px;
}

@media (max-width: 768px) {
    .company-tabs-bar { flex-wrap: wrap; }
    .company-tab { max-width: 100%; }
    .infographics-body { grid-template-columns: 1fr; }
    .comparison-grid { grid-template-columns: 1fr; }
    .comparison-grid .cg-header:first-child { display: none; }
    .toolbar-section { justify-content: center; }
    .toolbar-divider { display: none; }
}


/* ═══════════════════════════════════════════
   12.35 ENHANCED DEEP-DIVE VISUALS (Long Equity Style)
   ═══════════════════════════════════════════ */

/* ── Tabs Navigation ── */
/* ═══════════════════════════════════════════
   12.34 DEEP-DIVE TAB FIXES
   ═══════════════════════════════════════════ */
.dd-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1000;
    padding-top: 4px;
    flex-shrink: 0;
}
.dd-tab-content {
    display: none;
    position: relative;
    z-index: 1;
    padding-top: 20px;
}
.dd-tab-content.active {
    display: block;
}

/* ═══════════════════════════════════════════
   12.36 DUAL COMPANY COMPARISON
   ═══════════════════════════════════════════ */
.company-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 4px;
    position: relative;
}
.company-tab {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    border-radius: var(--radius-md);
    transition: all .25s;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.company-tab:hover { color: var(--text); }
.company-tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.company-tab .ct-icon { font-size: 16px; }
.company-tab .ct-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-tab .ct-score {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 700;
}
.company-tab-edit {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0;
    transition: all .2s;
}
.company-tab:hover .company-tab-edit { opacity: 1; }
.company-tab-edit:hover { background: var(--bg); color: var(--text); }

.compare-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--primary-light);
}
.compare-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.compare-toggle-desc {
    font-size: 11px;
    color: var(--text-muted);
}
.compare-toggle {
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background .3s;
}
.compare-toggle.active { background: var(--primary); }
.compare-toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--surface);
    border-radius: 50%;
    top: 2px;
    right: 2px;
    transition: transform .3s;
    box-shadow: var(--shadow-sm);
}
.compare-toggle.active::after { transform: translateX(-22px); }

/* ═══════════════════════════════════════════
   12.37 INFOGRAPHICS GALLERY
   ═══════════════════════════════════════════ */
/* ═══════════════════════════════════════════
   12.38 AI PROMPT GENERATOR
   ═══════════════════════════════════════════ */
.ai-prompt-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    backdrop-filter: blur(8px);
    z-index: 1300;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ai-prompt-modal.open { display: flex; }
.ai-prompt-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}
.ai-prompt-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #4F46E5 0%, #a78bfa 100%);
}
.ai-prompt-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-prompt-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: rgba(255,255,255,0.8);
    transition: all .2s;
}
.ai-prompt-close:hover { background: rgba(255,255,255,0.2); color: white; }
.ai-prompt-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.ai-prompt-section {
    margin-bottom: 20px;
}
.ai-prompt-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-prompt-textarea {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    resize: vertical;
    background: #1E1B4B;
    color: rgba(20,184,166,0.12);
    direction: ltr;
    text-align: left;
}
.ai-prompt-textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.ai-prompt-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.ai-prompt-btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
}
.ai-prompt-btn.primary {
    background: var(--primary);
    color: white;
}
.ai-prompt-btn.primary:hover { background: var(--primary-hover); }
.ai-prompt-btn.secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.ai-prompt-btn.secondary:hover { background: var(--surface); border-color: var(--primary-light); }

.ai-instructions {
    background: linear-gradient(135deg, rgba(245,158,11,0.12) 0%, rgba(245,158,11,0.2) 100%);
    border-radius: var(--radius-md);
    padding: 14px;
    border-right: 4px solid #F59E0B;
    margin-bottom: 16px;
}
.ai-instructions-title {
    font-size: 12px;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 6px;
}
.ai-instructions-text {
    font-size: 12px;
    color: #78350F;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════
   12.39 ENHANCED CSV EXPORT
   ═══════════════════════════════════════════ */
.csv-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    backdrop-filter: blur(8px);
    z-index: 1300;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.csv-modal.open { display: flex; }
.csv-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
}
.csv-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.csv-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.csv-body {
    padding: 24px;
}
.csv-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
}
.csv-option:hover { border-color: var(--primary-light); }
.csv-option-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.csv-option-info { flex: 1; }
.csv-option-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.csv-option-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   12.40 TOOLBAR BUTTON FOR INFOGRAPHICS
   ═══════════════════════════════════════════ */
.toolbar-btn-info {
    background: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%) !important;
    color: white !important;
    border: none !important;
}
.toolbar-btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20,184,166,0.3);
}

@media (max-width: 768px) {
    .company-tabs { flex-direction: column; }
    .company-tab { padding: 10px 16px; }
    .infographics-body { grid-template-columns: 1fr; padding: 16px; }
    .ai-prompt-textarea { min-height: 150px; }
}

.dd-tab {
    padding: 10px 16px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all .2s;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.dd-tab:hover { color: var(--text); background: var(--bg); }
.dd-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
    background: var(--primary-bg);
}


/* ── Flow Diagram (Like Long Equity) ── */
.dd-flow-container {
    margin-bottom: 24px;
}
.dd-flow-question {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.4;
}
.dd-flow-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.dd-flow-box {
    flex: 1;
    min-width: 130px;
    max-width: 200px;
    background: linear-gradient(135deg, #1e293b 0%, #2d3748 100%);
    border: 2px solid #94A3B8;
    border-radius: 12px;
    padding: 14px 12px;
    text-align: center;
    position: relative;
    transition: all .3s;
}
.dd-flow-box:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary-bg) 0%, rgba(20,184,166,0.12) 100%);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.dd-flow-box .fb-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.dd-flow-box .fb-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
}
.dd-flow-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    flex-shrink: 0;
    color: #64748B;
    font-size: 18px;
}

/* ── Why Section Cards ── */
.dd-why-section {
    margin-bottom: 20px;
}
.dd-why-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.dd-why-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all .25s;
}
.dd-why-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.dd-why-card .wc-question {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.dd-why-card .wc-answer {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.dd-why-card .wc-answer strong {
    color: var(--text);
    font-weight: 600;
}
.dd-why-card .wc-list {
    margin-top: 8px;
    padding-right: 16px;
}
.dd-why-card .wc-list li {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ── Barriers Section (Like slide 2) ── */
.dd-barriers-section {
    margin-bottom: 24px;
}
.dd-barriers-question {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}
.dd-barriers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.dd-barrier-box {
    background: linear-gradient(135deg, #1a2332 0%, #1e293b 100%);
    border: 2px solid #334155;
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    transition: all .25s;
}
.dd-barrier-box:hover {
    border-color: var(--primary-light);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.dd-barrier-box .bb-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.dd-barrier-box .bb-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}
.dd-barrier-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.dd-barrier-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}
.dd-barrier-detail .bd-question {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.dd-barrier-detail .bd-answer {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}
.dd-barrier-detail .bd-examples-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: underline;
    margin-bottom: 6px;
}
.dd-barrier-detail .bd-examples {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.dd-barrier-detail .bd-examples strong {
    color: var(--text);
    font-weight: 700;
}

/* ── Real Examples Section ── */
.dd-examples-section {
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}
.dd-examples-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(20,184,166,0.25);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dd-examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.dd-example-card {
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all .2s;
}
.dd-example-card:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}
.dd-example-card .ec-company {
    font-size: 13px;
    font-weight: 700;
    color: white;
    margin-bottom: 2px;
}
.dd-example-card .ec-ticker {
    font-size: 10px;
    background: rgba(20,184,166,0.5);
    color: rgba(20,184,166,0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 8px;
}
.dd-example-card .ec-value {
    font-size: 22px;
    font-weight: 800;
    color: #6EE7B7;
    margin-bottom: 6px;
    direction: ltr;
    text-align: right;
}
.dd-example-card .ec-context {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
}

/* ── Key Insight Box ── */
.dd-insight-box {
    background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(16,185,129,0.12) 100%);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    border-right: 5px solid #059669;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}
.dd-insight-box .ib-icon {
    font-size: 24px;
    flex-shrink: 0;
}
.dd-insight-box .ib-content {
    flex: 1;
}
.dd-insight-box .ib-title {
    font-size: 13px;
    font-weight: 700;
    color: #34d399;
    margin-bottom: 4px;
}
.dd-insight-box .ib-text {
    font-size: 12.5px;
    color: #047857;
    line-height: 1.65;
}

/* ── Visual Scale Enhanced ── */
.dd-scale-enhanced {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 20px;
}
.dd-scale-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.dd-scale-bar-wrap {
    position: relative;
    margin-bottom: 8px;
}
.dd-scale-bar {
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(to left, #DC2626 0%, #F97316 25%, #F59E0B 50%, #10B981 75%, #0d9488 100%);
}
.dd-scale-marker {
    position: absolute;
    top: -4px;
    width: 22px;
    height: 22px;
    background: var(--surface);
    border: 3px solid var(--text);
    border-radius: 50%;
    transform: translateX(50%);
    box-shadow: var(--shadow-md);
    transition: right .5s ease-out;
}
.dd-scale-labels {
    display: flex;
    justify-content: space-between;
    padding-top: 8px;
}
.dd-scale-label {
    text-align: center;
    font-size: 10px;
}
.dd-scale-label .sl-emoji { font-size: 14px; display: block; margin-bottom: 2px; }
.dd-scale-label .sl-text { color: var(--text-secondary); font-weight: 600; }
.dd-your-value-box {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    text-align: center;
}
.dd-your-value-box .yv-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.dd-your-value-box .yv-num {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dd-your-value-box .yv-verdict {
    font-size: 13px;
    font-weight: 600;
    margin-top: 2px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    display: inline-block;
}

/* ── Optional Metrics Picker ── */
.optional-metrics-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 18px;
    margin-bottom: 16px;
}
.oms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.oms-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.oms-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.oms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.oms-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all .2s;
}
.oms-item:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}
.oms-item.added {
    border-color: var(--success);
    background: var(--success-bg);
}
.oms-item .oi-icon {
    width: 36px;
    height: 36px;
    background: var(--surface);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.oms-item.added .oi-icon {
    background: var(--success);
    border-color: var(--success);
}
.oms-item.added .oi-icon::after {
    content: '✓';
    color: white;
    font-size: 16px;
    font-weight: 700;
}
.oms-item:not(.added) .oi-icon::after {
    content: attr(data-icon);
}
.oms-item .oi-info { flex: 1; min-width: 0; }
.oms-item .oi-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.oms-item .oi-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.4;
}
.oms-item .oi-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}
.oms-item .oi-badge.cat-profitability { background: rgba(37,99,235,0.12); color: #60a5fa; }
.oms-item .oi-badge.cat-growth { background: rgba(16,185,129,0.12); color: #34d399; }
.oms-item .oi-badge.cat-valuation { background: rgba(245,158,11,0.12); color: #fbbf24; }
.oms-item .oi-badge.cat-stability { background: rgba(239,68,68,0.12); color: #f87171; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .dd-flow-row { flex-direction: column; align-items: center; gap: 8px; }
    .dd-flow-arrow { transform: rotate(90deg); width: auto; height: 24px; margin: -4px 0; }
    .dd-flow-box { max-width: 100%; min-width: 100%; }
    .dd-barriers-grid { grid-template-columns: 1fr; }
    .dd-barrier-details { grid-template-columns: 1fr; }
    .dd-why-grid { grid-template-columns: 1fr; }
    .dd-examples-grid { grid-template-columns: 1fr 1fr; }
    .dd-tabs { gap: 2px; }
    .dd-tab { padding: 8px 10px; font-size: 11px; }
    .oms-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .dd-examples-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   12.4 METRIC DEEP-DIVE MODAL
   ═══════════════════════════════════════════ */
.deepdive-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .3s;
}
.deepdive-modal.open { display: flex; opacity: 1; }
.deepdive-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 94%;
    max-width: 720px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.96) translateY(12px);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.deepdive-modal.open .deepdive-box { transform: scale(1) translateY(0); }

.deepdive-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--surface) 100%);
}
.deepdive-header-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.deepdive-header-text { flex: 1; min-width: 0; }
.deepdive-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}
.deepdive-header-cat {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    display: inline-block;
}
.deepdive-close {
    position: absolute;
    top: 16px; left: 16px;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--text-muted);
    transition: all .2s;
}
.deepdive-close:hover { background: var(--bg); color: var(--text); }

.deepdive-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Formula Section ── */
.dd-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.dd-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dd-section-title::before {
    content: '';
    width: 4px; height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

.dd-formula-box {
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.dd-formula-main {
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
    direction: ltr;
    text-align: center;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}
.dd-formula-main .fm-num { color: #A5B4FC; }
.dd-formula-main .fm-den { color: #C4B5FD; }
.dd-formula-main .fm-op { color: #6EE7B7; margin: 0 6px; }
.dd-formula-parts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.dd-formula-part {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.dd-formula-part .fp-symbol {
    font-size: 13px;
    font-weight: 700;
    color: #A5B4FC;
    direction: ltr;
}
.dd-formula-part .fp-meaning {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    text-align: center;
}

/* ── Interpretation Scale ── */
.dd-scale-wrap {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.dd-scale-bar {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to left, #DC2626 0%, #F59E0B 33%, #10B981 66%, #0d9488 100%);
    position: relative;
    margin-bottom: 8px;
}
.dd-scale-marker {
    position: absolute;
    top: -6px;
    width: 24px; height: 24px;
    background: var(--surface);
    border: 3px solid var(--text);
    border-radius: 50%;
    transform: translateX(50%);
    box-shadow: var(--shadow-md);
    transition: right .6s cubic-bezier(.4,0,.2,1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
}
.dd-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}
.dd-scale-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.dd-scale-label .sl-emoji { font-size: 16px; }
.dd-scale-label .sl-text {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}
.dd-scale-label .sl-range {
    font-size: 9px;
    color: var(--text-muted);
    direction: ltr;
}
.dd-your-value {
    text-align: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.dd-your-value .yv-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.dd-your-value .yv-num {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dd-your-value .yv-verdict {
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}

/* ── Analogy Card ── */
.dd-analogy {
    background: linear-gradient(135deg, rgba(245,158,11,0.08) 0%, rgba(245,158,11,0.15) 100%);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    border-right: 4px solid #F59E0B;
}
.dd-analogy-title {
    font-size: 13px;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dd-analogy-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.7;
}

/* ── Pitfalls Card ── */
.dd-pitfalls {
    background: linear-gradient(135deg, rgba(239,68,68,0.08) 0%, rgba(239,68,68,0.15) 100%);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    border-right: 4px solid #DC2626;
}
.dd-pitfalls-title {
    font-size: 13px;
    font-weight: 700;
    color: #f87171;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dd-pitfall-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.dd-pitfall-item:last-child { margin-bottom: 0; }
.dd-pitfall-item .pi-icon {
    flex-shrink: 0;
    width: 18px; height: 18px;
    background: #DC2626;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    margin-top: 2px;
}
.dd-pitfall-item .pi-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
}

/* ── Related Metrics ── */
.dd-related {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.dd-related-item {
    flex: 1;
    min-width: 140px;
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    border: 1px solid var(--border);
    transition: all .2s;
    cursor: pointer;
}
.dd-related-item:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
    transform: translateY(-2px);
}
.dd-related-item .ri-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.dd-related-item .ri-relation {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.dd-related-item .ri-arrow {
    font-size: 10px;
    color: var(--primary);
    margin-top: 6px;
    display: block;
}

/* ═══════════════════════════════════════════
   12.45 METRIC INTERPRETATION PANEL
   ═══════════════════════════════════════════ */
.metric-interpretation {
    display: none;
    margin-top: 8px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--surface) 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-light);
    border-right: 4px solid var(--primary);
    animation: interpFadeIn .4s ease-out;
}
.metric-interpretation.visible { display: block; }
@keyframes interpFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.interp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.interp-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}
.interp-title svg { width: 14px; height: 14px; }
.interp-toggle {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    transition: all .2s;
}
.interp-toggle:hover { background: var(--surface); color: var(--text); }
.interp-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.75;
}
.interp-body strong {
    color: var(--text);
    font-weight: 600;
}
.interp-verdict {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}
.interp-verdict.excellent { background: rgba(37,99,235,0.12); color: #60a5fa; }
.interp-verdict.good { background: rgba(16,185,129,0.12); color: #34d399; }
.interp-verdict.average { background: rgba(245,158,11,0.12); color: #fbbf24; }
.interp-verdict.poor { background: rgba(239,68,68,0.12); color: #f87171; }
.interp-questions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--primary-light);
}
.interp-questions-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}
.interp-question {
    font-size: 12px;
    color: var(--text-secondary);
    padding-right: 14px;
    position: relative;
    margin-bottom: 4px;
    line-height: 1.5;
}
.interp-question::before {
    content: '?';
    position: absolute;
    right: 0;
    color: var(--primary);
    font-weight: 700;
}
.interp-xref {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.interp-xref strong { color: var(--text); }

/* ── Deep-dive Responsive ── */
@media (max-width: 768px) {
    .deepdive-box { width: 98%; max-height: 95vh; }
    .deepdive-header { padding: 20px; gap: 12px; }
    .deepdive-header-icon { width: 44px; height: 44px; font-size: 20px; }
    .deepdive-header h2 { font-size: 1.1rem; }
    .deepdive-content { padding: 20px; gap: 20px; }
    .dd-formula-main { font-size: 1.1rem; }
    .dd-formula-parts { gap: 6px; }
    .dd-formula-part { padding: 6px 10px; }
    .dd-related { flex-direction: column; }
    .dd-related-item { min-width: 100%; }
    .metric-interpretation { padding: 12px 14px; }
}

/* ═══════════════════════════════════════════
   12.5 INSIGHTS PANEL
   ═══════════════════════════════════════════ */
.insights-section {
    margin-top: 32px;
    animation: fadeUp .6s ease-out .35s both;
}
.insights-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}
.insights-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #EF4444, #F59E0B, #0d9488, #059669);
    opacity: 0.85;
}

.insights-header {
    padding: 24px 28px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.insights-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.insights-header-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, #1E1B4B, #312E81);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.insights-header-icon svg { width: 22px; height: 22px; color: #A5B4FC; }
.insights-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.insights-header-subtitle {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 1px;
}
.insights-toggle-btn {
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    transition: all .2s;
}
.insights-toggle-btn:hover {
    background: var(--surface-active);
    color: var(--text);
    border-color: var(--border-hover);
}

.insights-body {
    padding: 0 28px 28px;
}
.insights-body.collapsed { display: none; }

.insights-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
}
.insights-empty svg {
    width: 48px;
    height: 48px;
    color: var(--border);
    margin-bottom: 12px;
    display: inline-block;
}

#insights-content {
    display: none;
}
#insights-content.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Category Rings ── */
.insights-rings {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.ring-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px 14px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    transition: all .25s;
}
.ring-item:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xs);
}
.ring-svg { width: 68px; height: 68px; }
.ring-svg circle {
    transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1), stroke .5s;
}
.ring-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}
.ring-score {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Heatmap ── */
.insights-heatmap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.heatmap-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.heatmap-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.heatmap-cell {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: transform .2s, box-shadow .2s;
    position: relative;
}
.heatmap-cell:hover {
    transform: scale(1.14);
    box-shadow: var(--shadow-md);
    z-index: 5;
}
.heatmap-cell .hm-abbr {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.95;
    line-height: 1;
}
.heatmap-cell .hm-score {
    font-size: 9px;
    font-weight: 500;
    opacity: 0.75;
    margin-top: 2px;
}
.heatmap-cell.hm-empty {
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1.5px dashed var(--border);
}
.heatmap-cell.hm-filled {
    color: white;
    box-shadow: var(--shadow-xs);
}

/* ── Severity Summary ── */
.severity-summary {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.severity-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    transition: transform .15s;
}
.severity-badge:hover { transform: scale(1.04); }
.severity-badge .sev-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.severity-badge.sev-critical {
    background: rgba(239,68,68,0.08);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.2);
}
.severity-badge.sev-critical .sev-dot {
    background: #DC2626;
    animation: sevPulse 1.5s ease-in-out infinite;
}
.severity-badge.sev-warning {
    background: rgba(245,158,11,0.08);
    color: #fbbf24;
    border: 1px solid rgba(245,158,11,0.2);
}
.severity-badge.sev-warning .sev-dot { background: #D97706; }
.severity-badge.sev-positive {
    background: rgba(16,185,129,0.08);
    color: #34d399;
    border: 1px solid rgba(16,185,129,0.2);
}
.severity-badge.sev-positive .sev-dot { background: #059669; }
.severity-badge.sev-info {
    background: rgba(20,184,166,0.08);
    color: #134e4a;
    border: 1px solid rgba(20,184,166,0.25);
}
.severity-badge.sev-info .sev-dot { background: #0d9488; }

@keyframes sevPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.5); }
}

/* ── Insight Groups ── */
.insight-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.insight-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--bg-subtle);
}
.insight-group-title .igt-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    flex-shrink: 0;
}
.igt-icon.critical { background: var(--danger); }
.igt-icon.warning { background: var(--warning); }
.igt-icon.positive { background: var(--success); }
.igt-icon.info { background: var(--primary); }

/* ── Individual Insight Card ── */
.insight-item {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border-right: 4px solid transparent;
    transition: all .2s;
    cursor: default;
}
.insight-item:hover {
    transform: translateX(-3px);
}
.insight-item.sev-critical {
    border-right-color: #DC2626;
    background: linear-gradient(to left, rgba(239,68,68,0.08) 0%, var(--bg) 80%);
}
.insight-item.sev-critical:hover { background: linear-gradient(to left, rgba(239,68,68,0.12) 0%, var(--surface-hover) 80%); }
.insight-item.sev-warning {
    border-right-color: #D97706;
    background: linear-gradient(to left, rgba(245,158,11,0.08) 0%, var(--bg) 80%);
}
.insight-item.sev-warning:hover { background: linear-gradient(to left, rgba(245,158,11,0.12) 0%, var(--surface-hover) 80%); }
.insight-item.sev-positive {
    border-right-color: #059669;
    background: linear-gradient(to left, rgba(16,185,129,0.08) 0%, var(--bg) 80%);
}
.insight-item.sev-positive:hover { background: linear-gradient(to left, rgba(16,185,129,0.12) 0%, var(--surface-hover) 80%); }
.insight-item.sev-info {
    border-right-color: #0d9488;
    background: linear-gradient(to left, rgba(20,184,166,0.08) 0%, var(--bg) 80%);
}
.insight-item.sev-info:hover { background: linear-gradient(to left, rgba(20,184,166,0.12) 0%, var(--surface-hover) 80%); }

.insight-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
}
.insight-icon.critical { background: rgba(239,68,68,0.12); }
.insight-icon.warning { background: rgba(245,158,11,0.12); }
.insight-icon.positive { background: rgba(16,185,129,0.12); }
.insight-icon.info { background: rgba(20,184,166,0.12); }

.insight-content { flex: 1; min-width: 0; }
.insight-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
    line-height: 1.4;
}
.insight-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.65;
}
.insight-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}
.insight-metric-pill {
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 600;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* ── Strongest / Weakest ── */
.insights-extremes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.extreme-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.extreme-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 4px;
}
.extreme-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    transition: background .15s;
}
.extreme-item:hover { background: var(--surface-hover); }
.extreme-rank {
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.extreme-rank.strong { background: rgba(16,185,129,0.12); color: #34d399; }
.extreme-rank.weak { background: rgba(239,68,68,0.12); color: #f87171; }
.extreme-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.extreme-bar-wrap {
    width: 44px;
    height: 5px;
    background: var(--bg-subtle);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.extreme-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .6s cubic-bezier(.4,0,.2,1);
}
.extreme-score-val {
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    text-align: left;
    direction: ltr;
}

/* ── Insights Responsive ── */
@media (max-width: 768px) {
    .insights-header { padding: 20px; flex-wrap: wrap; }
    .insights-body { padding: 0 16px 20px; }
    #insights-content.active { gap: 20px; }
    .insights-rings { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .ring-svg { width: 56px; height: 56px; }
    .heatmap-cell { width: 44px; height: 44px; }
    .heatmap-cell .hm-abbr { font-size: 9px; }
    .insights-extremes { grid-template-columns: 1fr; }
    .insight-item { padding: 12px; gap: 10px; }
    .insight-icon { width: 32px; height: 32px; font-size: 15px; }
}
@media (max-width: 480px) {
    .insights-rings { grid-template-columns: repeat(2, 1fr); }
    .heatmap-cell { width: 38px; height: 38px; }
    .heatmap-cell .hm-score { display: none; }
    .severity-summary { gap: 6px; }
    .severity-badge { padding: 5px 10px; font-size: 11px; }
}

/* ═══════════════════════════════════════════
   13. ANIMATIONS
   ═══════════════════════════════════════════ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ═══════════════════════════════════════════
   14. RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .app { padding: 16px 12px 40px; }
    .hero { padding: 20px 0 4px; }
    .hero h1 { font-size: 1.6rem; }
    .input-card { padding: 16px; }
    .controls-row { flex-direction: column; align-items: stretch; }
    .mode-tabs { align-self: center; }
    .toolbar { justify-content: center; }
    .category-body { grid-template-columns: 1fr; }
    .metric-card { padding: 16px; }
    .score-card { padding: 20px 16px; }
    .gauge-wrap { max-width: 220px; }
    .topbar-company { max-width: 120px; font-size: 13px; }
    .topbar-brand-name { font-size: 13px; }
    .topbar-center { display: none !important; }
    .modal-box { padding: 20px; width: 95%; }
    .form-row { grid-template-columns: 1fr; }
    .form-weights { flex-direction: column; }
}
@media (max-width: 480px) {
    .tool-btn span { display: none; }
    .tool-btn { padding: 8px 10px; }
    .topbar { padding: 0 12px; }
    .topbar-brand-name { display: none; }
    .topbar-sep { display: none; }
    .template-grid { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
    
/* ═══════════════════════════════════════════
   FIX: Deep-dive tabs z-index and positioning
   ═══════════════════════════════════════════ */
.deepdive-content {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sticky tabs that ALWAYS stay visible above content */
.deepdive-content .dd-tabs {
    position: sticky !important;
    top: 0 !important;
    background: var(--surface) !important;
    z-index: 1000 !important;
    margin: -24px -28px 0 -28px !important;
    padding: 16px 28px 0 28px !important;
    border-bottom: 2px solid var(--border) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

/* Content area below tabs - ensure lower z-index */
.dd-tab-content {
    position: relative;
    z-index: 1;
    padding-top: 20px;
}

.dd-tab-content > * {
    position: relative;
    z-index: 1;
}

/* Ensure ALL child elements don't overlap tabs */
.dd-flow-container,
.dd-scale-enhanced,
.dd-insight-box,
.dd-why-section,
.dd-barriers-section,
.dd-examples-section,
.dd-analogy,
.dd-pitfalls,
.dd-section,
.dd-formula-box,
.dd-related,
.dd-interp-box,
.dd-calc-section {
    position: relative;
    z-index: 1;
}

