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

:root {
    --ink: #0F3D5C;
    --ink-90: rgba(15, 61, 92, 0.90);
    --ink-70: rgba(15, 61, 92, 0.70);
    --ink-55: rgba(15, 61, 92, 0.55);
    --ink-30: rgba(15, 61, 92, 0.30);
    --ink-15: rgba(15, 61, 92, 0.15);
    --ink-10: rgba(15, 61, 92, 0.10);
    --ink-06: rgba(15, 61, 92, 0.06);
    --sky: #1DA9D8;
    --sky-soft: #E6F5FB;
    --gold: #E5BD56;
    --gold-soft: #FBF1D9;
    --gold-edge: #E5BD56;
    --gold-deep: #B98F1E;
    --bg: #FAFAF7;
    --paper: #FFFFFF;
    --cost: #A32D2D;
    --cost-soft: #FBECEC;
    --halal: #3F6B4F;
    --halal-soft: #E9F0EB;
    --shadow-card: 0 1px 0 rgba(15, 61, 92, 0.04), 0 1px 2px rgba(15, 61, 92, 0.04);
    --radius: 10px;
    --radius-lg: 16px;
}

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

body.ig-body,
html.ig-html {
    margin: 0;
    padding: 0;
    background: #f0ece5 !important;
    color: var(--ink);
    font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: 0.003em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ───────── Canvas (fixed 1600×1080, auto-scales to fit viewport) ───────── */
.canvas-shell {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #f0ece5;
    z-index: 99999;
}

.canvas {
    width: 1600px;
    min-height: 1080px;
    height: auto;
    background: var(--bg);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    box-shadow: 0 24px 80px -30px rgba(15, 61, 92, 0.30);
    overflow: visible;
    display: flex;
    flex-direction: column;
}

/* ───────── Header ───────── */
.topbar {
    border-bottom: 1px solid var(--ink-10);
    background: var(--paper);
    flex: none;
}

.topbar-inner {
    padding: 16px 40px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
}

.topbar-inner>.logo {
    justify-self: start;
}

.topbar-inner>.topbar-headline {
    justify-self: center;
}

.topbar-inner>.pills {
    justify-self: end;
    margin-left: 0;
}

.topbar-headline {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.008em;
    color: var(--ink);
    margin: 0;
    white-space: nowrap;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #15517e;
    font-family: 'DM Sans', sans-serif;
}

.pills {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    padding: 7px 16px 7px 13px;
    border-radius: 8px;
    border: 1px solid var(--ink-10);
    background: var(--paper);
    transition: border-color 180ms, box-shadow 180ms;
}

.pill:hover {
    border-color: var(--ink-15);
    box-shadow: 0 1px 2px rgba(15, 61, 92, 0.05);
}

.pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: none;
    position: relative;
}

.pill-dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: 0.18;
}

.pill-dot.halal {
    background: var(--halal);
    color: var(--halal);
}

.pill-dot.gold {
    background: var(--gold-deep);
    color: var(--gold-deep);
}

.pill-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    gap: 1px;
}

.pill-meta .eyebrow-tiny {
    font-size: 8.5px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-55);
    font-weight: 600;
}

.pill-meta .label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.005em;
}

/* ───────── Page ───────── */
.page {
    flex: 1;
    padding: 22px 40px 18px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ───────── Section eyebrows (Guidance) ───────── */
.step-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex: none;
}

.step-no {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 20px;
    color: var(--gold-deep);
    line-height: 1;
    font-style: italic;
}

.step-tag {
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-70);
    font-weight: 600;
}

.step-rule {
    flex: 1;
    height: 1px;
    background: var(--ink-10);
}

.step-hint {
    font-size: 12px;
    color: var(--ink-55);
    font-style: italic;
}

/* ───────── Cockpit grid ───────── */
.stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 20px;
    align-items: stretch;
}

.split>* {
    height: 100%;
}

/* ───────── Config card ───────── */
.config {
    background: var(--paper);
    border: 1px solid var(--ink-10);
    border-radius: var(--radius-lg);
    padding: 16px 24px 18px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.config-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 22px;
    margin: 0 0 12px;
    color: var(--ink);
}

.slider-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: none;
    justify-content: flex-start;
}

.slider {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ink-06);
}

.slider-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.slider-label .name {
    font-size: 13px;
    color: var(--ink-70);
    letter-spacing: 0.02em;
    font-weight: 600;
}

.slider-label .val {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 26px;
    color: var(--ink);
    line-height: 1;
}

.slider-label .val .unit {
    font-size: 14px;
    color: var(--ink-55);
    margin-left: 4px;
    font-family: 'DM Sans', sans-serif;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--ink-10);
    border-radius: 2px;
    outline: none;
    margin: 4px 0 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 120ms;
    box-shadow: 0 1px 3px rgba(15, 61, 92, 0.18);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.12);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
}

.slider-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--ink-55);
    font-variant-numeric: tabular-nums;
}

.toggles {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px dashed var(--ink-10);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-70);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.info-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--ink-30);
    color: var(--ink-55);
    display: inline-grid;
    place-items: center;
    font-size: 9px;
    font-weight: 700;
    cursor: help;
}

.seg {
    display: flex;
    background: var(--ink-06);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--ink-10);
    width: 100%;
}

.seg input[type="radio"] {
    display: none;
}

.seg label {
    border: 0;
    background: transparent;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-70);
    border-radius: 7px;
    cursor: pointer;
    transition: all 160ms;
    flex: 1;
    white-space: nowrap;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.seg input[type="radio"]:checked+label {
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(15, 61, 92, 0.10), 0 0 0 1px var(--ink-10);
}

.seg label .badge {
    display: inline-block;
    padding: 1px 6px;
    background: var(--gold);
    color: var(--ink);
    border-radius: 999px;
    font-size: 9.5px;
    letter-spacing: 0.04em;
    font-weight: 700;
}

/* ───────── KPI row ───────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    flex: none;
}

.kpi {
    background: var(--paper);
    border: 1px solid var(--ink-10);
    border-radius: var(--radius-lg);
    padding: 14px 18px 14px;
    position: relative;
    transition: box-shadow 200ms, transform 200ms;
    cursor: help;
}

.kpi:hover {
    box-shadow: 0 8px 22px -10px rgba(15, 61, 92, 0.20);
    transform: translateY(-1px);
}

.kpi .lab {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-55);
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpi .lab .ico {
    width: 24px;
    height: 24px;
    background: var(--ink-06);
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--ink);
}

.kpi .lab .ico svg {
    width: 13px;
    height: 13px;
}

.kpi .num {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 30px;
    line-height: 1.05;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.kpi .num .unit {
    font-size: 16px;
    color: var(--ink-55);
    font-family: 'DM Sans', sans-serif;
    margin-left: 4px;
}

.kpi .foot {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--ink-55);
}

.kpi.advantage {
    background: var(--gold-soft);
    border-color: var(--gold-edge);
}

.kpi.advantage .lab {
    color: var(--gold-deep);
}

.kpi.advantage .lab .ico {
    background: rgba(185, 143, 30, 0.15);
    color: var(--gold-deep);
}

.kpi.advantage::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 38px;
    height: 38px;
    border-top-right-radius: var(--radius-lg);
    background: linear-gradient(225deg, var(--gold) 0%, var(--gold) 50%, transparent 50.5%);
    opacity: 0.7;
}

/* Tooltip */
.kpi .tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    width: 230px;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms, transform 160ms;
    z-index: 10;
    white-space: pre-line;
    box-shadow: 0 8px 24px -8px rgba(15, 61, 92, 0.4);
}

.kpi .tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--ink);
}

.kpi:hover .tip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ───────── Right column (chart + savings) ───────── */
.right-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Savings highlights */
.saving-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    flex: none;
}

.saving {
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    background: var(--gold-soft);
    border: 1px solid var(--gold-edge);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: opacity 240ms, filter 240ms;
    min-height: 64px;
}

.saving.dim {
    opacity: 0.35;
    filter: saturate(0.4);
}

.saving .ico {
    width: 40px;
    height: 40px;
    background: var(--paper);
    border: 1px solid var(--gold-edge);
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--gold-deep);
    flex: none;
}

.saving .ico svg {
    width: 20px;
    height: 20px;
}

.saving .meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.saving .meta .name {
    font-size: 13.5px;
    color: var(--ink-70);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.saving .meta .desc {
    font-size: 12px;
    color: var(--ink-55);
    line-height: 1.4;
}

.saving .amount {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 30px;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.saving .amount .minus {
    color: var(--gold-deep);
}

/* Chart */
.chart-card {
    background: var(--paper);
    border: 1px solid var(--ink-10);
    border-radius: var(--radius-lg);
    padding: 18px 26px 18px;
    box-shadow: var(--shadow-card);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.chart-head {
    margin-bottom: 14px;
    flex: none;
}

.chart-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}

.growth-picker {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.gp-label {
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-55);
    font-weight: 600;
}

.gp-seg {
    display: inline-flex;
    background: var(--ink-06);
    border: 1px solid var(--ink-10);
    border-radius: 7px;
    padding: 2px;
    gap: 1px;
}

.gp-seg button {
    border: 0;
    background: transparent;
    padding: 5px 11px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-55);
    border-radius: 5px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    transition: all 140ms;
    letter-spacing: 0.01em;
}

.gp-seg button.active {
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 1px 1px rgba(15, 61, 92, 0.08), 0 0 0 1px var(--ink-10);
}

.chart-head h3 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 22px;
    margin: 0 0 2px;
}

.chart-head .sub2 {
    color: var(--ink-55);
    font-size: 12.5px;
}

.bars {
    display: flex;
    flex-direction: column;
    gap: 28px;
    flex: 1;
    justify-content: center;
}

.bar-row {
    display: grid;
    grid-template-columns: 230px 1fr 160px;
    align-items: center;
    gap: 18px;
}

.bar-name {
    font-size: 14.5px;
    color: var(--ink-70);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.bar-track {
    height: 48px;
    background: var(--ink-06);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 420ms cubic-bezier(.22, 1, .36, 1);
    position: relative;
    min-width: 4px;
}

.bar-fill.einzahlung {
    background: var(--sky);
}

.bar-fill.kosten {
    background: var(--cost);
}

.bar-fill.wert {
    background: var(--ink);
}

.bar-fill.gewinn {
    background: var(--gold);
    box-shadow: inset 0 0 0 1px var(--gold-deep);
}

.bar-value {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 22px;
    color: var(--ink);
    text-align: right;
    letter-spacing: -0.005em;
}

.bar-row.hero .bar-name {
    color: var(--gold-deep);
    font-weight: 700;
}

.bar-row.hero .bar-value {
    color: var(--gold-deep);
}

.bar-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    margin-left: 248px;
    margin-right: 178px;
    font-size: 11.5px;
    color: var(--ink-55);
    font-variant-numeric: tabular-nums;
    flex: none;
}

/* ───────── CTA strip (bottom band) ───────── */
.cta-strip {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 20px;
    background: var(--paper);
    border: 1px solid var(--ink-10);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    flex: none;
}

.cta-strip .stp {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
}

.cta-strip .stp .step-no {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 22px;
    color: var(--gold-deep);
    line-height: 1;
    font-style: italic;
}

.cta-strip .stp .step-tag {
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-70);
    font-weight: 600;
}

.cta-strip .rule {
    width: 1px;
    height: 36px;
    background: var(--ink-10);
    flex: none;
}

.cta-strip .grow {
    flex: 1;
}

.btn {
    border: 0;
    padding: 13px 22px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 180ms;
    white-space: nowrap;
}

.btn-primary {
    background: var(--ink);
    color: #fff;
    border: 1px solid var(--ink);
}

.btn-primary:hover {
    background: #0b3149;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px -10px rgba(15, 61, 92, 0.45);
}

.btn-primary svg {
    width: 16px;
    height: 16px;
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink-30);
}

.btn-secondary:hover {
    background: var(--ink-06);
}

.btn-secondary.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
    box-shadow: 0 4px 14px -6px rgba(15, 61, 92, 0.40);
}

/* ───────── Footer ───────── */
.canvas-foot {
    flex: none;
    padding: 10px 40px 12px;
    border-top: 1px solid var(--ink-10);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: var(--ink-55);
    gap: 16px;
    background: var(--paper);
}

.canvas-foot a {
    color: var(--ink-70);
    text-decoration: none;
    border-bottom: 1px solid var(--ink-15);
    cursor: pointer;
}

.canvas-foot a:hover {
    color: var(--ink);
}

/* ───────── Modal ───────── */
.ig-modal-back {
    position: fixed;
    inset: 0;
    background: rgba(15, 61, 92, 0.32);
    display: grid;
    place-items: center;
    z-index: 999999;
    padding: 32px;
    animation: fade 180ms ease-out;
}

@keyframes fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ig-modal {
    background: var(--paper);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px -20px rgba(15, 61, 92, 0.5);
}

.ig-modal-head {
    padding: 22px 28px;
    border-bottom: 1px solid var(--ink-10);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ig-modal-head h3 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    margin: 0;
    font-size: 26px;
    color: #0f3d5c;
}

.ig-modal-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--ink-70);
    display: grid;
    place-items: center;
}

.ig-modal-close:hover {
    background: var(--ink-06);
}

.ig-modal-body {
    overflow-y: auto;
    padding: 8px 28px 24px;
}

table.ledger {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

table.ledger th {
    text-align: left;
    padding: 14px 12px 10px;
    font-weight: 600;
    color: var(--ink-55);
    border-bottom: 1px solid var(--ink-10);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}

table.ledger td {
    padding: 12px;
    border-bottom: 1px solid var(--ink-06);
    color: var(--ink);
}

table.ledger td.r,
table.ledger th.r {
    text-align: right;
}

table.ledger tr:hover td {
    background: var(--ink-06);
}

.chart-head h3 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 22px;
    margin: 0 0 2px;
    color: #0f3d5c;
}

/* Loading Animation */
.ig-updating {
    opacity: 0.6;
    pointer-events: none;
}

.value-change {
    animation: pulse-val 0.4s ease-out;
}

@keyframes pulse-val {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ───────── Bar Axis Row & Custom Premium Dropdown ───────── */
.bar-axis-row {
    display: grid;
    grid-template-columns: 230px 1fr 160px;
    gap: 18px;
    align-items: center;
    margin-top: -6px;
}
.bar-axis-row .bar-axis {
    margin: 0;
}
.chart-footer-row {
    display: flex;
    justify-content: flex-start;
    margin-top: 24px;
}
.chart-footer-row .growth-picker-select-container {
    width: 230px;
}
.growth-picker-select-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
}
.growth-picker-select-container .select-label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-55);
    font-weight: 600;
    line-height: 1;
}
.custom-select-wrapper {
    position: relative;
    display: block;
    width: 100%;
}
.custom-select {
    width: 100%;
    height: 38px;
    padding: 0 32px 0 12px;
    font-family: 'DM Sans', sans-serif !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    color: var(--ink) !important;
    background-color: var(--paper) !important;
    border: 1px solid var(--ink-15) !important;
    border-radius: 8px !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 180ms ease;
    box-shadow: 0 1px 2px rgba(15, 61, 92, 0.04);
}
.custom-select:focus {
    outline: none;
    border-color: var(--gold-deep) !important;
    box-shadow: 0 0 0 3px rgba(185, 143, 30, 0.12);
}
.custom-select:hover {
    border-color: var(--ink-30) !important;
    background-color: #fcfcfc !important;
}
/* Premium chevron arrow */
.custom-select-wrapper::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4.5px solid transparent;
    border-right: 4.5px solid transparent;
    border-top: 4.5px solid var(--ink-55);
    pointer-events: none;
    transition: transform 180ms ease, border-top-color 180ms;
}
.custom-select-wrapper:focus-within::after {
    border-top-color: var(--gold-deep);
    transform: translateY(-50%) rotate(180deg);
}

/* ───────── Responsive Design ───────── */
@media (max-width: 1200px) {
    .canvas-shell {
        position: relative;
        overflow: auto;
        min-height: 100vh;
        background: var(--bg);
    }

    .canvas {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh;
        transform: none !important;
        top: 0 !important;
        left: 0 !important;
        box-shadow: none;
    }

    .split {
        grid-template-columns: 1fr;
    }

    .page {
        padding: 20px;
    }

    .topbar-inner {
        padding: 20px;
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 14px;
    }

    .topbar-inner>.logo {
        justify-self: center;
    }

    .topbar-inner>.pills {
        justify-self: center;
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .kpi-row {
        grid-template-columns: 1fr 1fr;
    }

    .bar-row {
        grid-template-columns: 140px 1fr 100px;
        gap: 10px;
    }

    .bar-axis {
        margin-left: 150px;
        margin-right: 110px;
    }

    .saving-row {
        grid-template-columns: 1fr;
    }

    .bar-axis-row {
        grid-template-columns: 140px 1fr 100px;
        gap: 10px;
        align-items: center;
        margin-top: -6px;
    }

    .bar-axis-row .bar-axis {
        margin: 0 !important;
    }

    .chart-footer-row {
        display: flex;
        justify-content: flex-start;
        margin-top: 20px;
    }

    .chart-footer-row .growth-picker-select-container {
        width: 140px;
    }
}

@media (max-width: 768px) {

    /* ── Scroll fix + overflow containment ── */
    .canvas-shell {
        position: relative !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh;
        max-width: 100vw;
    }

    .canvas {
        position: relative !important;
        transform: none !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }

    .page {
        padding: 12px 14px;
        overflow-x: hidden;
        max-width: 100%;
        box-sizing: border-box;
    }

    .stage {
        gap: 14px;
        overflow: visible;
        min-height: auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* ── Header: compact & centered ── */
    .topbar-inner {
        padding: 10px 14px;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 8px;
        text-align: left;
        justify-items: start;
        box-sizing: border-box;
        max-width: 100%;
    }

    .topbar-headline {
        display: none;
    }

    .logo h1 {
        font-size: 15px;
    }

    .logo img {
        height: 22px !important;
        width: auto !important;
    }

    .logo svg {
        width: 16px !important;
        height: 16px !important;
        margin-right: 6px !important;
    }

    .topbar-inner>.pills {
        justify-self: end;
        margin-left: 0;
        flex-wrap: nowrap;
        gap: 4px;
    }

    .pill {
        padding: 4px 7px 4px 6px;
        gap: 5px;
        border-radius: 6px;
    }

    .pill-meta .eyebrow-tiny {
        display: none;
    }

    .pill-meta .label {
        font-size: 10px;
    }

    .pill-dot {
        width: 6px;
        height: 6px;
    }

    /* ── KPI: 1 column ── */
    .kpi-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .kpi {
        padding: 12px 14px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .kpi .num {
        font-size: 26px;
    }

    .kpi .foot {
        font-size: 12px;
    }

    /* ── Chart card: prevent overflow ── */
    .chart-card {
        height: auto;
        padding: 10px 8px;
        overflow: visible;
        max-width: 100%;
        box-sizing: border-box;
    }

    .chart-head-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .chart-head-row>div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }

    .chart-head h3 {
        font-size: 17px;
    }

    .growth-picker {
        align-items: flex-start;
        max-width: 100%;
    }

    .gp-seg {
        flex-wrap: wrap;
    }

    .tab-view {
        overflow: visible;
        max-width: 100%;
    }

    #historyChart {
        padding-top: 8px;
        overflow: visible;
    }

    /* ── Bar rows: fully fluid ── */
    .bars {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 4px;
        margin-bottom: 24px;
        max-width: 100%;
        overflow: hidden;
    }

    .bar-track {
        height: 36px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .bar-fill {
        max-width: 100%;
    }

    .bar-axis {
        display: none;
    }

    .bar-axis-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .bar-axis-row .bar-axis {
        display: none !important;
    }

    .chart-footer-row {
        display: flex;
        justify-content: flex-start;
        margin-top: 20px;
        width: 100%;
    }

    .chart-footer-row .growth-picker-select-container {
        width: 100%;
    }

    .bar-value {
        text-align: left;
        font-size: 17px;
    }

    .bar-name {
        font-size: 13px;
        margin-bottom: 2px;
    }

    /* ── Config card ── */
    .config {
        height: auto;
        padding: 14px;
        overflow: hidden;
        max-width: 100%;
        box-sizing: border-box;
    }

    .config-title {
        font-size: 18px;
    }

    .slider-grid {
        width: 100%;
        max-width: 100%;
    }

    .slider {
        width: 100%;
        max-width: 100%;
    }

    .slider-label {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
    }

    .slider-label .val {
        font-size: 20px;
    }

    input[type="range"] {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* ── Seg controls: prevent overflow ── */
    .toggles {
        width: 100%;
        max-width: 100%;
    }

    .seg {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        flex-wrap: nowrap;
    }

    .seg label {
        padding: 8px 6px;
        font-size: 12px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* ── Savings row ── */
    .saving-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .saving {
        padding: 10px 14px;
        min-height: 56px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .saving .amount {
        font-size: 20px;
    }

    /* ── CTA strip ── */
    .cta-strip {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: center;
        padding: 14px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .cta-strip .stp {
        justify-content: center;
    }

    .cta-strip .rule {
        width: 100%;
        height: 1px;
    }

    .cta-strip .grow {
        display: none;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    /* ── Tabs ── */
    .chart-tabs {
        flex-wrap: wrap;
        gap: 8px;
        max-width: 100%;
    }

    .chart-tabs button {
        flex: 1;
        min-width: 100px;
        padding: 10px 12px;
        font-size: 12.5px;
    }

    /* ── Footer ── */
    .canvas-foot {
        padding: 14px 16px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    /* ── Modal ── */
    .ig-modal-back {
        padding: 0;
        align-items: flex-end;
    }

    .ig-modal {
        max-height: 90vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        width: 100%;
        max-width: 100%;
    }

    /* ── KPI tooltip: show below on mobile ── */
    .kpi .tip {
        bottom: auto;
        top: calc(100% + 8px);
        width: min(230px, 88vw);
        z-index: 9999;
    }

    .kpi .tip::after {
        top: auto;
        bottom: 100%;
        border-top-color: transparent;
        border-bottom-color: var(--ink);
    }
}