/* Base and accessibility -------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-padding-top: 90px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button, input, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { color: var(--accent); }
::selection { background: var(--accent); color: var(--accent-text); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.3; font-weight: 650; }
h2 { font-size: 16px; letter-spacing: -.22px; }
h3 { font-size: 14px; }
strong { font-weight: 650; }
small { font-size: 11px; }
svg { flex-shrink: 0; vertical-align: middle; }
button .icon { pointer-events: none; }
button, .card, input { transition: background-color .16s, border-color .16s, box-shadow .16s; }
input, select, textarea { color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--subtle); opacity: 1; }
input { font-variant-numeric: tabular-nums; }
input:focus, select:focus, textarea:focus { outline: none; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary:focus-visible { border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 14px; top: -80px; padding: 12px 18px; background: var(--accent); color: var(--accent-text); border-radius: 8px; z-index: 300; }
.skip-link:focus { top: 12px; }
.text-good { color: var(--positive) !important; }
.text-danger { color: var(--negative) !important; }
.subtle, .microcopy { color: var(--subtle); }
.microcopy { font-size: 11px; line-height: 1.6; }
.rule { height: 1px; background: var(--border-soft); margin: 23px 0; }
.full-width { width: 100%; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.boot-message, .fatal-error { margin: 60px auto; padding: 30px; max-width: 650px; }
.fatal-error p, .fatal-error pre { margin: 20px 0; white-space: pre-wrap; }

/* Application shell ------------------------------------------------------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); background: var(--sidebar); border-right: 1px solid var(--border-soft); padding: 0 16px 18px; z-index: 60; display: flex; flex-direction: column; }
.brand { height: 94px; display: flex; align-items: center; gap: 11px; background: transparent; border: 0; text-align: left; padding: 0 6px; flex-shrink: 0; }
.brand-mark { width: 39px; height: 39px; border-radius: 12px; background: #efa17c; color: #2e211c; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-wordmark { display: flex; flex-direction: column; gap: 3px; }
.brand-wordmark strong { font-size: 20px; letter-spacing: -.6px; }
.brand-wordmark small { font-size: 8px; letter-spacing: 1.7px; color: var(--subtle); font-weight: 600; }
.sidebar-divider { border-top: 1px solid var(--border-soft); }
.nav-caption { font-size: 9px; font-weight: 650; color: var(--subtle); letter-spacing: 1.7px; padding: 27px 13px 13px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item { min-height: 46px; width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: none; background: transparent; border-radius: 9px; font-size: 12.5px; color: var(--muted); text-align: left; line-height: 1.5; }
.nav-item:hover { background: var(--surface-raised); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-current-dot { margin-left: auto; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }
.sidebar-tip { padding: 18px 15px; border: 1px solid var(--border-soft); border-radius: 12px; margin-top: auto; margin-bottom: 22px; background: var(--surface); }
.tip-icon { display: inline-flex; color: var(--accent); margin-bottom: 13px; }
.sidebar-tip h3 { font-size: 12px; line-height: 1.5; margin-bottom: 9px; }
.sidebar-tip p { font-size: 11px; line-height: 1.8; color: var(--subtle); }
.sidebar-tip button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 17px; padding: 10px 0 0; border: 0; border-top: 1px solid var(--border-soft); background: transparent; color: var(--accent); font-size: 11px; }
.sidebar-bottom { padding-top: 18px; }
.local-status { display: flex; gap: 10px; align-items: center; margin-top: 17px; padding: 18px 7px 0; border-top: 1px solid var(--border-soft); }
.status-logo { display: flex; width: 33px; height: 33px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); }
.local-status strong { font-size: 10px; display: block; }
.local-status small { display: block; font-size: 9px; color: var(--subtle); margin-top: 3px; }
.app-main { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { min-height: var(--topbar-height); padding: 0 34px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 25px; position: sticky; top: 0; z-index: 40; background: var(--bg); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; font-size: 11px; white-space: nowrap; }
.breadcrumbs > span { color: var(--subtle); }
.breadcrumbs .icon { color: var(--subtle); }
.global-search { display: flex; align-items: center; gap: 9px; min-width: 0; max-width: 340px; flex: 1; margin-left: auto; padding: 8px 11px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--input); text-align: left; font-size: 11px; color: var(--subtle); }
.global-search > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search kbd { margin-left: auto; font-size: 9px; white-space: nowrap; }
kbd { font-family: var(--font); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 10px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.save-status { display: flex; gap: 6px; align-items: center; font-size: 10px; color: var(--subtle); padding-right: 7px; }
.save-status i, .live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--positive); flex-shrink: 0; }
.save-status.is-dirty i { background: var(--warning); }
.language-button { display: flex; gap: 7px; align-items: center; height: 36px; padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 11px; font-weight: 600; background: transparent; }
.mobile-brand, .bottom-nav, .mobile-dock, .mobile-profit-preview { display: none; }
.page-container { max-width: 1472px; padding: 33px 34px 20px; margin: 0 auto; min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { display: flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 650; color: var(--subtle); letter-spacing: 1.5px; line-height: 1.5; }
.eyebrow-line { width: 18px; height: 2px; background: var(--accent); }
.page-heading h1 { font-size: clamp(27px,2.25vw,35px); letter-spacing: -1.1px; line-height: 1.2; margin-top: 10px; }
.page-heading p { color: var(--muted); font-size: 12px; margin-top: 10px; line-height: 1.65; }
.heading-actions { display: flex; gap: 10px; flex-shrink: 0; }
.page-footer { display: flex; gap: 20px; justify-content: space-between; font-size: 10px; color: var(--subtle); padding: 38px 1px 16px; border-top: 1px solid var(--border-soft); margin-top: 36px; }
.page-note { display: flex; align-items: flex-start; gap: 8px; color: var(--subtle); font-size: 11px; margin-top: 24px; }
.migration-notice { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--info-soft); font-size: 12px; color: var(--info); }
.migration-notice p { flex: 1; }

/* Shared controls and cards ---------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 10px 15px; font-weight: 600; font-size: 11.5px; line-height: 1.4; border: 1px solid transparent; border-radius: 8px; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--subtle); }
.btn-danger { background: var(--negative-soft); color: var(--negative); border-color: var(--negative); }
.btn-small { min-height: 34px; padding: 8px 11px; font-size: 10.5px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 35px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); flex-shrink: 0; }
.icon-btn:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--border); color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 23px; min-width: 0; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 23px; }
.card-heading-main { display: flex; gap: 12px; align-items: center; min-width: 0; }
.card-heading h2 { font-size: 15px; }
.card-heading p { color: var(--subtle); font-size: 11px; margin-top: 5px; line-height: 1.65; }
.section-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--surface-raised); color: var(--muted); flex-shrink: 0; }
.input-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 20px; }
.form-grid-three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field { min-width: 0; margin-bottom: 10px; }
.field > label { display: block; font-size: 11.5px; font-weight: 550; color: var(--muted); margin-bottom: 8px; line-height: 1.55; }
.input-wrap { display: flex; align-items: center; border: 1px solid var(--border); background: var(--input); border-radius: 8px; min-height: 45px; overflow: hidden; }
.input-wrap input { min-width: 0; width: 100%; padding: 12px 13px; border: none; background: transparent; font-size: 14px; font-weight: 550; line-height: 1.4; height: 44px; }
.input-wrap .affix + input { padding-left: 9px; }
.input-wrap:focus-within, .select-wrap:focus-within, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-large { min-height: 55px; }
.input-large input { height: 54px; font-size: 25px; font-weight: 550; letter-spacing: -.6px; }
.affix { color: var(--subtle); font-size: 14px; padding-left: 14px; white-space: nowrap; }
.input-large .affix { font-size: 20px; }
.suffix { padding: 0 13px 0 5px; font-size: 12px; }
.field small { display: block; color: var(--subtle); font-size: 10px; line-height: 1.6; margin-top: 7px; }
.field.has-error .input-wrap { border-color: var(--negative); }
.field .field-error { color: var(--negative); }
.range { display: block; appearance: none; -webkit-appearance: none; width: 100%; margin: 7px 0 0; background: transparent; height: 25px; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: linear-gradient(to right,var(--accent) var(--range-pct),var(--border) var(--range-pct)); }
.range::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; height: 13px; width: 13px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); margin-top: -4.5px; }
.range::-moz-range-track { height: 4px; background: var(--border); border-radius: 3px; }
.range::-moz-range-progress { height: 4px; background: var(--accent); }
.range::-moz-range-thumb { height: 11px; width: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.select-wrap { position: relative; border: 1px solid var(--border); background: var(--input); border-radius: 8px; min-width: 0; }
.select-wrap select { appearance: none; width: 100%; min-width: 0; border: none; background: transparent; padding: 12px 32px 12px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; text-overflow: ellipsis; }
.select-wrap > .icon { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
select option { background: var(--surface); color: var(--text); }
textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 12px; resize: vertical; background: var(--input); }
.segments { display: flex; align-items: stretch; padding: 4px; gap: 4px; border: 1px solid var(--border-soft); border-radius: 9px; background: var(--input); }
.segments button { flex: 1; min-height: 36px; padding: 8px 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--subtle); display: flex; justify-content: center; align-items: center; gap: 7px; font-size: 11.5px; white-space: nowrap; }
.segments button.active { background: var(--surface-raised); border-color: var(--border); color: var(--text); font-weight: 600; box-shadow: 0 2px 4px #00000010; }
.segments button:hover { color: var(--text); }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 15px 1px; font-size: 12px; background: transparent; color: var(--subtle); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; padding: 4px 8px; border-radius: 5px; font-size: 9px; line-height: 1.45; font-weight: 600; white-space: nowrap; }
.badge i { width: 4px; height: 4px; background: currentColor; border-radius: 50%; }
.good { color: var(--positive); background: var(--positive-soft); }
.warn { color: var(--warning); background: var(--warning-soft); }
.danger { color: var(--negative); background: var(--negative-soft); }
.info { color: var(--info); background: var(--info-soft); }
.neutral { color: var(--muted); background: var(--surface-raised); }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: 9px; border: 1px solid var(--border); font-size: 11px; line-height: 1.75; margin-bottom: 18px; }
.notice > .icon { margin-top: 1px; }
.notice .btn { margin-top: 10px; }
.notice p + small { display: block; }
.toggle-row { display: flex; gap: 15px; align-items: center; justify-content: space-between; position: relative; cursor: pointer; min-height: 52px; }
.toggle-row > span:first-child { flex: 1; }
.toggle-label { font-size: 12px; }
.toggle-row small { display: block; color: var(--subtle); margin-top: 4px; }
.toggle-row input { position: absolute; opacity: 0; right: 0; width: 40px; height: 30px; cursor: pointer; }
.switch { width: 33px; height: 19px; border-radius: 12px; background: var(--border); position: relative; pointer-events: none; }
.switch:after { content: ''; width: 13px; height: 13px; position: absolute; left: 3px; top: 3px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.toggle-row input:checked + .switch { background: var(--accent); }
.toggle-row input:checked + .switch:after { transform: translateX(14px); background: var(--accent-text); }
.toggle-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Calculator -------------------------------------------------------------- */
.product-toolbar { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 9px; }
.product-symbol { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-symbol.digital { background: #26253d; color: #c0b5ec; }
.product-symbol.physical { background: #312c24; color: #dec39e; }
[data-theme='light'] .product-symbol.digital { background: #eeebfb; color: #7462a8; }
[data-theme='light'] .product-symbol.physical { background: #f7eddf; color: #896635; }
.product-selection { min-width: 0; flex: 1; max-width: 440px; }
.product-selection > label { display: block; font-size: 9px; color: var(--subtle); margin-bottom: 2px; }
.product-selection .select-wrap { background: transparent; border-color: transparent; margin-left: -6px; }
.product-selection select { font-size: 13px; font-weight: 600; padding: 3px 30px 3px 5px; }
.toolbar-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.toolbar-divider { width: 1px; height: 23px; background: var(--border); margin: 0 5px; }
.calculator-layout { display: grid; grid-template-columns: minmax(0,1fr) 334px; gap: 24px; align-items: start; }
.calculator-editor { min-width: 0; }
.result-rail { min-width: 0; position: sticky; top: 96px; }
.result-stack { display: flex; flex-direction: column; gap: 18px; }
.pricing-card .segments { max-width: 270px; margin-bottom: 24px; }
.pricing-fields { gap: 23px; }
.pricing-fields > .field:last-child .input-wrap { min-height: 55px; }
.pricing-fields > .field:last-child .input-wrap input { height: 54px; font-size: 22px; }
.price-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--input); border: 1px solid var(--border-soft); padding: 15px 18px; border-radius: 9px; margin-top: 5px; }
.price-preview > div { display: flex; flex-direction: column; gap: 4px; }
.price-preview > div:last-child { text-align: right; }
.price-preview span { font-size: 10px; color: var(--subtle); }
.price-preview strong { font-size: 19px; letter-spacing: -.25px; font-variant-numeric: tabular-nums; }
.price-preview > div:last-child strong { color: var(--accent); }
.price-preview > .icon { color: var(--subtle); }
.tax-detail { margin-top: 16px; }
.tax-detail > summary { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--subtle); min-height: 30px; }
.tax-detail > summary strong { margin-left: auto; color: var(--muted); font-size: 11px; }
.tax-detail > .field { margin-top: 16px; }
.input-accordion { padding: 0; overflow: hidden; }
.input-accordion > summary { display: flex; align-items: center; gap: 12px; padding: 20px 22px; min-height: 82px; }
.section-number { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; flex-shrink: 0; }
.accordion-label { flex: 1; min-width: 0; }
.accordion-label strong { display: block; font-size: 13px; }
.accordion-label small { display: block; font-size: 10px; margin-top: 4px; color: var(--subtle); line-height: 1.6; }
.input-accordion > summary > .icon { color: var(--subtle); }
.input-accordion[open] > summary > .icon { transform: rotate(180deg); }
.accordion-body { padding: 0 23px 20px; }
.marketing-fields { padding-top: 22px; }
.marketing-fields > .field { max-width: 220px; }
.cpa-stat { background: var(--input); border: 1px solid var(--border-soft); border-radius: 9px; padding: 11px 14px; align-self: start; margin-top: 2px; }
.cpa-stat > span { display: block; font-size: 10px; color: var(--subtle); }
.cpa-stat > strong { display: block; font-size: 24px; font-weight: 550; margin: 4px 0; }
.cpa-stat > small { display: block; font-size: 9px; color: var(--subtle); line-height: 1.5; }
.inline-help { display: flex; gap: 7px; align-items: center; color: var(--subtle); font-size: 11px; }
.profit-card { border: 1px solid var(--profit-border); background: var(--profit-bg); border-radius: var(--radius); padding: 23px; }
.profit-card-top { display: flex; align-items: center; justify-content: space-between; color: var(--positive); margin-bottom: 22px; }
.profit-card-top .eyebrow { color: var(--profit-text); font-size: 8px; letter-spacing: 1.1px; }
.profit-label { font-size: 12px; color: var(--profit-text); margin-bottom: 6px; }
.profit-number { font-size: 59px; font-weight: 550; line-height: 1.12; letter-spacing: -2.4px; color: var(--positive); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.profit-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.profit-meta > span:not(.badge) { font-size: 10px; color: var(--profit-text); }
.target-line { display: flex; align-items: center; justify-content: space-between; font-size: 10px; margin-top: 24px; color: var(--profit-text); }
.target-line strong { color: var(--positive); }
.target-track { height: 4px; position: relative; border-radius: 4px; background: var(--border); margin: 9px 0 13px; }
.target-track > span { position: absolute; left: 0; top: 0; height: 4px; border-radius: 4px; background: var(--positive); }
.target-track > i { position: absolute; top: -3px; height: 10px; width: 2px; border-radius: 2px; background: var(--text); }
.profit-card .microcopy { color: var(--profit-text); font-size: 9px; }
.breakdown-card h2 { font-size: 14px; margin-bottom: 15px; }
.money-row { display: flex; align-items: baseline; gap: 16px; justify-content: space-between; padding: 7px 0; font-size: 11px; color: var(--muted); }
.money-row > span { display: flex; align-items: center; gap: 7px; }
.money-row > strong { color: var(--text); font-weight: 550; white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-row.is-total { border-top: 1px solid var(--border-soft); padding-top: 13px; margin-top: 6px; color: var(--text); font-weight: 600; }
.legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0; }
.legend-dot.fees, .segment-fees { background: var(--fees-color); }
.legend-dot.ads, .segment-ads { background: var(--ads-color); }
.legend-dot.own, .segment-own { background: var(--own-color); }
.legend-dot.ship, .segment-ship { background: var(--ship-color); }
.legend-dot.profit, .segment-profit { background: var(--profit-color); }
.allocation-bar { display: flex; gap: 3px; height: 6px; overflow: hidden; border-radius: 6px; margin: 18px 0; }
.fee-details { border-top: 1px solid var(--border-soft); margin-top: 14px; padding-top: 5px; }
.fee-details summary { display: flex; justify-content: space-between; align-items: center; min-height: 36px; font-size: 10px; color: var(--subtle); }
.fee-details[open] summary > .icon { transform: rotate(180deg); }
.fee-details .money-row { font-size: 10px; }
.loss-note { font-size: 10px; color: var(--negative); margin-top: 9px; }
.recommend-card { background: var(--recommend-bg); border: 1px solid var(--recommend-border); border-radius: var(--radius); padding: 21px 23px; }
.recommend-title { display: flex; gap: 8px; align-items: center; color: var(--accent); }
.recommend-title h2 { font-size: 12px; font-weight: 600; }
.recommend-card p { font-size: 11px; line-height: 1.7; color: var(--muted); margin-top: 10px; }
.recommended-number { font-size: 34px; letter-spacing: -.9px; line-height: 1.3; font-variant-numeric: tabular-nums; color: var(--accent); margin: 15px 0 18px; }
.recommended-number > span { font-size: 10px; letter-spacing: 0; color: var(--subtle); margin-left: 10px; }
.recommend-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--subtle); font-size: 10px; margin-top: 15px; }
.recommend-foot strong { color: var(--muted); }

/* Price/volume plots and scenarios --------------------------------------- */
.sensitivity-card .card-heading { margin-bottom: 16px; }
.curve-summary { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--subtle); font-size: 10px; }
.curve-summary strong { color: var(--text); margin-left: 4px; font-weight: 550; }
.curve svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-area { fill: var(--profit-color); opacity: .07; }
.chart-line { fill: none; stroke: var(--positive); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-zero { stroke: var(--border); stroke-width: 1; }
.chart-cursor { stroke: var(--subtle); stroke-width: 1; stroke-dasharray: 3 4; opacity: .6; }
.chart-point { fill: var(--positive); stroke: var(--surface); stroke-width: 3; }
.chart-labels { display: flex; justify-content: space-between; color: var(--subtle); font-size: 10px; font-variant-numeric: tabular-nums; padding: 0 8px; margin-top: 5px; }
.chart-data { border-top: 1px solid var(--border-soft); margin-top: 15px; padding-top: 4px; }
.chart-data > summary { min-height: 32px; display: flex; align-items: center; color: var(--subtle); font-size: 10px; }
.chart-data > summary:after { content: '+'; margin-left: auto; font-size: 15px; }
.chart-data[open] > summary:after { content: '-'; }
.scenario-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.scenario-card { border: 1px solid var(--border); border-radius: 10px; padding: 17px 12px 13px; background: var(--input); min-width: 0; }
.scenario-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.scenario-icon { color: var(--muted); margin-bottom: 14px; }
.scenario-card h3 { font-size: 12px; }
.scenario-profit { font-size: 27px; letter-spacing: -.6px; margin-top: 12px; font-variant-numeric: tabular-nums; }
.scenario-card > small { display: block; font-size: 10px; color: var(--subtle); margin: 6px 0 18px; }
.scenario-card .btn { font-size: 9px; padding: 8px 4px; }
.saved-scenario-list { display: flex; flex-direction: column; gap: 15px; }
.saved-scenario { padding: 17px; border: 1px solid var(--border); border-radius: 10px; background: var(--input); }
.saved-scenario-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.saved-scenario-heading > div { min-width: 0; }
.saved-scenario-heading h3 { overflow-wrap: anywhere; font-size: 13px; }
.saved-scenario-heading small { display: block; color: var(--subtle); font-size: 10px; margin-top: 4px; }
.scenario-values { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; padding: 16px 0; }
.scenario-values span { display: block; font-size: 10px; color: var(--subtle); margin-bottom: 5px; }
.scenario-values strong { font-size: 15px; }
.empty-inline { text-align: center; padding: 30px 15px; color: var(--subtle); font-size: 12px; }
.empty-inline .icon { color: var(--muted); margin-bottom: 10px; }

/* Product library --------------------------------------------------------- */
.library-metrics { display: flex; align-items: center; gap: 23px; color: var(--subtle); font-size: 11px; margin-bottom: 21px; }
.library-metrics > span { display: flex; align-items: center; gap: 6px; }
.library-metrics strong { color: var(--text); }
.library-card { padding: 0; overflow: hidden; }
.library-filters { display: flex; align-items: flex-end; gap: 20px; padding: 22px 24px 16px; }
.library-filters > .field { margin: 0; width: 200px; }
.library-filters > .field > label { font-size: 10px; margin-bottom: 5px; }
.search-input { position: relative; display: flex; align-items: center; gap: 10px; background: var(--input); border: 1px solid var(--border); border-radius: 8px; padding: 0 13px; color: var(--subtle); min-height: 44px; }
.search-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input input { width: 100%; min-width: 0; border: 0; padding: 12px 0; font-size: 12px; background: transparent; }
.library-filters .search-input { flex: 1; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px 22px; }
.filter-row .segments { background: transparent; border: 0; padding: 0; gap: 6px; }
.filter-row .segments button { min-height: 32px; padding: 6px 11px; font-size: 10px; }
.result-count { font-size: 10px; color: var(--subtle); }
.product-table { border-collapse: collapse; width: 100%; table-layout: auto; text-align: left; }
.product-table th { background: var(--input); font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--subtle); font-weight: 550; padding: 12px 14px; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.product-table td { border-bottom: 1px solid var(--border-soft); padding: 20px 14px; font-size: 12px; }
.product-table tbody tr:last-child td { border-bottom: 0; }
.product-table th:first-child, .product-table td:first-child { padding-left: 24px; }
.product-table th:last-child, .product-table td:last-child { padding-right: 24px; }
.product-table tbody tr:hover { background: var(--surface-raised); }
.product-name-btn { display: flex; align-items: center; gap: 12px; min-width: 0; text-align: left; width: 100%; border: 0; background: transparent; padding: 0; }
.product-name-btn strong { display: block; font-size: 12px; font-weight: 550; overflow-wrap: anywhere; }
.product-name-btn small { display: block; margin-top: 4px; color: var(--subtle); font-size: 10px; }
.product-name-btn .product-symbol { width: 38px; height: 42px; border-radius: 8px; }
.row-actions { white-space: nowrap; }
.row-actions .icon-btn { width: 28px; height: 32px; }
.empty-state { text-align: center; padding: 55px 25px; }
.empty-symbol { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; border-radius: 22px; border: 1px solid var(--border); margin: 0 auto 24px; color: var(--accent); background: var(--accent-soft); }
.empty-state h2 { font-size: 22px; letter-spacing: -.6px; }
.empty-state p { max-width: 400px; margin: 12px auto 23px; color: var(--subtle); font-size: 12px; }
.table-scroll { width: 100%; max-width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; min-width: 310px; }
.data-table th { padding: 13px 10px; border-bottom: 1px solid var(--border); color: var(--subtle); font-size: 10px; font-weight: 550; }
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; }
.data-table tbody tr:last-child td { border-bottom: 0; }

/* Monthly planner and insights ------------------------------------------- */
.planner-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; align-items: start; margin-top: 24px; }
.quick-values { display: flex; gap: 9px; margin: 6px 0 0; }
.quick-values button { flex: 1; min-height: 36px; border: 1px solid var(--border); background: transparent; border-radius: 7px; font-size: 11px; color: var(--muted); }
.quick-values button.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.section-description { font-size: 11px; color: var(--subtle); line-height: 1.8; margin: 8px 0 20px; }
.organic-share { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; font-size: 11px; border-top: 1px solid var(--border-soft); color: var(--muted); }
.organic-share > span { display: flex; align-items: center; gap: 8px; }
.organic-share strong { color: var(--positive); }
.monthly-profit { padding: 27px; }
.monthly-profit .profit-number { font-size: 54px; }
.monthly-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px solid var(--profit-border); margin-top: 26px; padding-top: 18px; }
.monthly-stat-grid span { display: block; font-size: 10px; color: var(--profit-text); }
.monthly-stat-grid strong { font-size: 19px; display: block; margin-top: 4px; font-variant-numeric: tabular-nums; }
.insight-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 17px; margin-bottom: 24px; }
.stat-card { padding: 20px; }
.stat-card > div { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; color: var(--subtle); font-size: 10px; }
.stat-card > strong { display: block; font-size: 32px; line-height: 1.2; letter-spacing: -.8px; margin-top: 21px; font-variant-numeric: tabular-nums; }
.portfolio-card { padding: 23px 0 0; margin-bottom: 24px; overflow: hidden; }
.portfolio-card > .card-heading { padding: 0 23px; }
.history-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.projection-card { border: 1px solid var(--border); background: var(--input); border-radius: 11px; padding: 17px; min-width: 0; }
.projection-icon { display: flex; align-items: center; justify-content: center; color: var(--accent); width: 32px; height: 34px; background: var(--accent-soft); border-radius: 8px; }
.projection-card h3 { font-size: 12px; margin-top: 15px; overflow-wrap: anywhere; }
.projection-card > small { display: block; color: var(--subtle); margin-top: 6px; font-size: 10px; }
.projection-amount { font-size: 30px; letter-spacing: -.9px; margin-top: 24px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.projection-card > .subtle { font-size: 10px; }
.projection-card details { margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.projection-card summary { font-size: 10px; color: var(--subtle); }
.projection-card details .money-row { font-size: 10px; }

/* Settings ---------------------------------------------------------------- */
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; align-items: start; }
.theme-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 15px 0 24px; }
.theme-option { background: transparent; border: 1px solid var(--border); border-radius: 9px; padding: 7px; text-align: left; min-width: 0; }
.theme-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.theme-option > span:last-child { display: flex; justify-content: space-between; align-items: center; padding: 9px 3px 1px; font-size: 10px; color: var(--muted); }
.theme-option.selected > span:last-child { color: var(--accent); }
.theme-preview { height: 64px; border-radius: 5px; display: grid; grid-template-columns: 22% 1fr 28%; gap: 4px; background: #111924; border: 1px solid #293747; padding: 9px 5px 5px; }
.theme-preview i { background: #27354a; border-radius: 2px; }
.theme-preview i:nth-child(2) { background: #1c293a; }
.preview-light { background: #f1f4f8; border-color: #d6dde7; }
.preview-light i { background: #c4cfde; }
.preview-light i:nth-child(2) { background: #ffffff; }
.preview-system { background: linear-gradient(90deg,#111924 50%,#edf1f7 50%); }
.preview-system i:nth-child(3) { background: #c4cfde; }
.currency-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 15px; }
.currency-code { font-size: 28px; font-weight: 550; letter-spacing: -.7px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 45px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--border-soft); }
.shortcut-row:last-child { border: 0; }
.shortcut-row kbd { white-space: nowrap; }
.backup-card { background: var(--surface); }
.backup-summary { display: flex; gap: 42px; margin: 26px 0; }
.backup-summary strong { display: block; font-size: 30px; }
.backup-summary span { display: block; font-size: 11px; color: var(--subtle); }
.sources-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin-bottom: 20px; }
.sources-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); text-decoration: none; font-size: 11px; color: var(--muted); }
.sources-list a:hover { color: var(--accent); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 25px; padding: 23px; border: 1px solid var(--border); border-radius: 12px; }
.danger-zone h3 { font-size: 12px; }
.danger-zone p { font-size: 11px; color: var(--subtle); margin-top: 6px; }

/* Dialogs and status ------------------------------------------------------ */
body.modal-open { overflow: hidden; }
.modal { color: var(--text); border: 1px solid var(--border); border-radius: 16px; background: var(--surface); width: min(560px,calc(100% - 32px)); max-height: min(86dvh,800px); padding: 0; box-shadow: 0 24px 100px #00000055; }
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop { background: var(--overlay); backdrop-filter: blur(5px); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 23px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.modal-heading h2 { font-size: 16px; }
.modal-body { padding: 23px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.modal-body .field { margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border-soft); margin-top: 24px; padding-top: 21px; }
.dialog-description { font-size: 12px; color: var(--muted); margin-bottom: 22px; line-height: 1.8; overflow-wrap: anywhere; }
.command-modal { width: min(610px,calc(100% - 32px)); }
.command-input { margin-bottom: 15px; }
.command-results > .eyebrow { padding: 17px 10px 9px; font-size: 9px; }
.command-result { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 8px; min-height: 48px; padding: 12px 10px; font-size: 12px; }
.command-result:hover, .command-result:focus-visible { background: var(--surface-raised); }
.command-result > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.command-result > .icon { color: var(--subtle); }
.command-result small { color: var(--subtle); font-size: 9px; }
.language-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.language-choice { position: relative; padding: 12px 34px 12px 13px; min-width: 0; border: 1px solid var(--border); background: var(--input); border-radius: 8px; text-align: left; }
.language-choice strong { display: block; font-size: 12px; }
.language-choice small { display: block; font-size: 10px; color: var(--subtle); margin-top: 3px; }
.language-choice > .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.language-choice.selected { color: var(--accent); border-color: var(--accent); }
.result-modal { width: min(470px,calc(100% - 32px)); }
.result-modal .modal-body { background: var(--bg); }
.toast { position: fixed; bottom: 25px; left: calc(50% + var(--sidebar-width)/2); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 17px; border: 1px solid var(--border); border-radius: 11px; box-shadow: 0 9px 40px #00000033; font-size: 12px; z-index: 120; max-width: min(580px,calc(100vw - 40px)); }
.toast > span { overflow-wrap: anywhere; }
.toast .icon-btn { width: 28px; height: 28px; }

/* Responsive: desktop -> tablet rail -> mobile task flow ------------------ */
@media (min-width: 1600px) {
  .calculator-layout { grid-template-columns: minmax(0,1fr) 365px; gap: 28px; }
  .page-container { padding: 40px; }
  .topbar { padding: 0 40px; }
  .card { padding: 27px; }
  .input-accordion { padding: 0; }
  .library-card { padding: 0; }
  .portfolio-card { padding: 27px 0 0; }
  .profit-card { padding: 27px; }
}
@media (max-height: 850px) and (min-width: 1100px) {
  .sidebar-tip { margin-top: 36px; margin-bottom: auto; }
  .sidebar-tip p { display: none; }
  .sidebar-tip { padding: 14px; }
  .sidebar-tip .tip-icon { margin-bottom: 8px; }
}
@media (max-width: 1279px) {
  .topbar { padding: 0 24px; gap: 17px; }
  .save-status > span { display: none; }
  .page-container { padding: 28px 24px 18px; }
  .calculator-layout { grid-template-columns: minmax(0,1fr) 302px; gap: 20px; }
  .card { padding: 20px; }
  .input-accordion, .library-card { padding: 0; }
  .portfolio-card { padding: 20px 0 0; }
  .profit-number { font-size: 51px; }
  .profit-card, .recommend-card { padding: 20px; }
  .product-table th, .product-table td { padding-left: 10px; padding-right: 10px; }
  .product-name-btn .product-symbol { display: none; }
  .history-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .scenario-grid { gap: 8px; }
  .scenario-card { padding: 14px 9px; }
  .scenario-profit { font-size: 23px; }
  .card-heading p { font-size: 10px; }
}
@media (max-width: 1099px) {
  :root { --sidebar-width: 76px; }
  .sidebar { padding: 0 11px 18px; }
  .brand { justify-content: center; padding: 0; height: 81px; }
  .brand-wordmark, .nav-caption, .sidebar-tip, .sidebar .nav-item > span, .nav-current-dot, .local-status > span:last-child { display: none; }
  .sidebar nav { gap: 9px; margin-top: 22px; }
  .sidebar .nav-item { min-height: 47px; justify-content: center; padding: 12px 0; }
  .sidebar-bottom { margin-top: auto; }
  .local-status { justify-content: center; padding: 17px 0 0; }
  .topbar { gap: 18px; }
  .global-search { max-width: 270px; }
  .page-heading h1 { font-size: 29px; }
  .heading-actions { gap: 7px; }
  .form-grid { gap: 10px 15px; }
  .form-grid-three { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .insight-stats { gap: 12px; }
  .stat-card { padding: 17px; }
  .stat-card > strong { font-size: 28px; }
  .stat-card > div .icon { display: none; }
  .settings-grid { gap: 20px; }
}
@media (max-width: 899px) {
  .calculator-layout { grid-template-columns: minmax(0,1fr); }
  .result-rail { display: none; }
  .mobile-profit-preview { display: flex; width: 100%; justify-content: space-between; align-items: center; text-align: left; gap: 16px; margin: 17px 0 7px; padding: 15px 19px; background: var(--profit-bg); border: 1px solid var(--profit-border); border-radius: 12px; }
  .mobile-profit-preview > div:first-child > span { display: block; font-size: 10px; color: var(--profit-text); }
  .mobile-profit-preview strong { display: block; font-size: 27px; color: var(--positive); letter-spacing: -.8px; margin-top: 3px; line-height: 1.25; }
  .mobile-profit-preview > div:last-child { display: flex; align-items: center; gap: 12px; }
  .mobile-profit-preview .icon { color: var(--positive); }
  .topbar .breadcrumbs > span, .topbar .breadcrumbs > .icon { display: none; }
  .topbar { gap: 14px; }
  .global-search { max-width: 290px; }
  .page-heading { gap: 16px; align-items: flex-start; }
  .page-heading h1 { font-size: 28px; }
  .page-heading p { font-size: 11px; }
  .heading-actions { margin-top: 25px; }
  .heading-actions .btn { padding: 10px 12px; font-size: 10px; }
  .planner-layout, .settings-grid { grid-template-columns: minmax(0,1fr); }
  .planner-layout > .input-stack:last-child { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .planner-layout > .input-stack:last-child > .card:last-child { grid-column: 1/-1; }
  .monthly-profit .profit-number { font-size: 40px; }
  .monthly-stat-grid { grid-template-columns: 1fr; gap: 14px; }
  .insight-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-filters { padding: 19px 20px 15px; }
  .filter-row { padding-left: 20px; padding-right: 20px; }
  .product-table { font-size: 10px; }
  .product-table .badge { font-size: 8px; }
  .product-table th, .product-table td { padding-left: 9px; padding-right: 9px; }
  .product-table .row-actions .icon-btn { width: 24px; }
  .sources-list { grid-template-columns: 1fr; }
  .scenario-grid { gap: 15px; }
  .scenario-card { padding: 20px 17px; }
  .scenario-card .btn { font-size: 10px; }
}
@media (max-width: 760px) {
  .product-table, .product-table tbody { display: block; }
  .product-table thead { display: none; }
  .product-table tbody { padding: 0 18px 18px; }
  .product-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 20px; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 14px; padding: 18px; background: var(--input); }
  .product-table tr:last-child { margin-bottom: 0; }
  .product-table td, .product-table td:first-child, .product-table td:last-child { display: block; padding: 0; border: none; min-width: 0; }
  .product-table td:first-child { grid-column: 1/-1; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
  .product-table td:not(:first-child):before { content: attr(data-label); display: block; font-size: 9px; color: var(--subtle); font-weight: 400; margin-bottom: 6px; }
  .product-table td.row-actions { display: flex; grid-column: 1/-1; justify-content: flex-end; padding-top: 9px; border-top: 1px solid var(--border-soft); gap: 8px; }
  .product-table td.row-actions:before { margin-right: auto; align-self: center; margin-bottom: 0; }
  .product-table .row-actions .icon-btn { width: 36px; height: 36px; border: 1px solid var(--border); }
  .product-name-btn .product-symbol { display: flex; }
  .product-table .badge { font-size: 9px; }
  .product-name-btn strong { font-size: 13px; }
  .product-table .numeric { font-size: 15px; }
  .heading-actions { margin-top: 0; }
  .page-heading { flex-direction: column; }
}
@media (max-width: 639px) {
  :root { --sidebar-width: 0px; --topbar-height: 62px; }
  body { font-size: 14px; }
  .sidebar { display: none; }
  .app-main { margin-left: 0; padding-bottom: calc(75px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 16px; gap: 8px; min-height: 64px; }
  .breadcrumbs { display: none; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-brand strong { font-size: 17px; letter-spacing: -.5px; }
  .mobile-brand .brand-mark { width: 31px; height: 33px; border-radius: 9px; }
  .global-search { margin-left: auto; flex: 0 0 35px; width: 35px; height: 42px; padding: 8px; border-color: transparent; background: transparent; color: var(--muted); }
  .global-search span, .global-search kbd, .save-status { display: none; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .icon-btn { width: 33px; height: 42px; }
  .language-button { height: 35px; font-size: 10px; gap: 5px; padding: 0 8px; }
  .page-container { padding: 25px 16px 20px; }
  .page-heading { gap: 19px; margin-bottom: 23px; }
  .page-heading h1 { font-size: 30px; letter-spacing: -1.05px; line-height: 1.22; margin-top: 9px; }
  .page-heading p { font-size: 12px; max-width: 380px; margin-top: 10px; line-height: 1.7; }
  .eyebrow { font-size: 8px; }
  .heading-actions { width: 100%; }
  .heading-actions .btn { min-height: 42px; font-size: 11px; padding: 11px 14px; }
  .btn { min-height: 44px; font-size: 12px; }
  .btn-small { min-height: 39px; font-size: 11px; }
  .icon-btn { width: 38px; height: 40px; }
  .product-toolbar { padding: 13px 12px; gap: 10px; margin-bottom: 0; }
  .product-toolbar > .product-symbol { width: 34px; height: 38px; border-radius: 8px; }
  .product-selection > label { font-size: 9px; }
  .product-selection select { font-size: 12px; padding-top: 5px; padding-bottom: 5px; }
  .toolbar-actions { gap: 0; }
  .toolbar-actions > .icon-btn:nth-child(2), .toolbar-divider { display: none; }
  .toolbar-actions > .icon-btn { width: 30px; height: 38px; }
  .mobile-profit-preview { padding: 14px 16px; }
  .mobile-profit-preview > div:last-child { gap: 9px; }
  .mobile-profit-preview .badge { font-size: 9px; }
  .tabs { margin-top: 4px; gap: 22px; margin-bottom: 20px; }
  .tabs button { font-size: 12px; gap: 6px; padding: 14px 0; min-height: 46px; }
  .tabs button .icon { width: 15px; }
  .card { padding: 19px 17px; border-radius: 12px; }
  .card-heading { margin-bottom: 20px; gap: 10px; }
  .card-heading h2 { font-size: 14px; }
  .card-heading p { font-size: 11px; line-height: 1.7; }
  .card-heading-main { gap: 10px; }
  .section-icon { width: 31px; height: 34px; }
  .input-stack, .result-stack { gap: 17px; }
  .form-grid, .form-grid-three { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 13px; }
  .field > label { font-size: 11px; min-height: 18px; }
  .input-wrap { min-height: 47px; }
  .input-wrap input, .select-wrap select, textarea, .search-input input { font-size: 16px; }
  .input-wrap input { height: 46px; }
  .select-wrap select { font-size: 16px; min-height: 45px; }
  .product-selection select { font-size: 16px; min-height: 32px; }
  .product-selection .select-wrap select { font-size: 16px; }
  .input-large input { font-size: 24px; height: 54px; }
  .input-large .affix { font-size: 19px; }
  .affix { padding-left: 12px; }
  .suffix { padding-right: 11px; }
  .field small { font-size: 10px; line-height: 1.65; }
  .range { height: 30px; }
  .range::-webkit-slider-thumb { height: 16px; width: 16px; margin-top: -6px; }
  .segments { gap: 3px; }
  .segments button { font-size: 11px; min-height: 39px; padding: 9px; }
  .pricing-card .segments { max-width: none; margin-bottom: 21px; }
  .pricing-fields { gap: 13px; }
  .pricing-fields > .field:last-child .input-wrap input { font-size: 22px; }
  .price-preview { padding: 13px 14px; }
  .price-preview strong { font-size: 19px; }
  .tax-detail > summary { min-height: 37px; font-size: 10px; }
  .input-accordion { padding: 0; }
  .input-accordion > summary { padding: 18px 16px; gap: 10px; min-height: 88px; }
  .accordion-label strong { font-size: 12.5px; }
  .accordion-label small { font-size: 10px; }
  .accordion-body { padding: 0 17px 17px; }
  .marketing-fields { padding-top: 20px; }
  .cpa-stat { padding: 10px; }
  .cpa-stat > strong { font-size: 24px; }
  .curve-summary { font-size: 9.5px; }
  .curve-summary > span { display: flex; flex-direction: column; gap: 4px; }
  .curve-summary > span:last-child { text-align: right; }
  .curve-summary strong { margin: 0; font-size: 13px; }
  .chart-data summary { min-height: 40px; font-size: 11px; }
  .chart-labels { font-size: 10px; }
  .bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; align-items: stretch; min-height: calc(67px + env(safe-area-inset-bottom)); padding: 7px 5px calc(6px + env(safe-area-inset-bottom)); background: var(--sidebar); border-top: 1px solid var(--border); z-index: 65; }
  .bottom-nav .nav-item { position: relative; flex-direction: column; justify-content: flex-start; text-align: center; gap: 4px; flex: 1; min-width: 0; min-height: 51px; padding: 5px 2px 0; font-size: 9px; line-height: 1.4; border-radius: 6px; }
  .bottom-nav .nav-item.active { background: transparent; color: var(--accent); }
  .bottom-nav .nav-item.active:before { content: ''; position: absolute; top: -7px; left: calc(50% - 12px); height: 2px; width: 24px; background: var(--accent); border-radius: 0 0 4px 4px; }
  .bottom-nav .nav-item > span { max-width: 72px; }
  .bottom-nav .nav-current-dot { display: none; }
  .mobile-dock { position: fixed; left: 16px; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 64px; padding: 11px 16px; border-radius: 12px; border: 1px solid var(--profit-border); background: var(--surface); box-shadow: 0 8px 40px #00000055; z-index: 50; text-align: left; }
  .mobile-dock > span:first-child small { color: var(--subtle); font-size: 9px; display: block; }
  .mobile-dock strong { font-size: 22px; color: var(--positive); letter-spacing: -.4px; line-height: 1.35; }
  .mobile-dock > span:last-child { color: var(--positive); display: flex; gap: 8px; align-items: center; font-size: 10px; }
  body.keyboard-open .mobile-dock, body.keyboard-open .bottom-nav { display: none; }
  .page-footer { display: block; padding-top: 24px; font-size: 9px; margin-top: 25px; }
  .page-footer > span:last-child { display: block; margin-top: 8px; }
  .scenario-grid { grid-template-columns: 1fr; gap: 12px; }
  .scenario-card { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 12px; align-items: center; padding: 17px; }
  .scenario-icon { grid-row: span 2; margin: 0; }
  .scenario-card h3 { grid-column: 2; font-size: 12px; }
  .scenario-profit { grid-column: 3; grid-row: 1; font-size: 25px; margin: 0; }
  .scenario-card > small { grid-column: 2/4; margin: 0 0 12px; }
  .scenario-card > .btn { grid-column: 1/-1; font-size: 11px; }
  .compare-section .card-heading { margin-bottom: 17px; }
  .card-heading > .btn { padding: 7px 9px; min-height: 36px; font-size: 10px; }
  .saved-scenario { padding: 14px; }
  .scenario-values { gap: 10px; }
  .scenario-values strong { font-size: 14px; }
  .library-card { padding: 0; }
  .library-filters { padding: 17px 17px 14px; flex-direction: column; align-items: stretch; gap: 12px; }
  .library-filters > .field { width: 100%; }
  .filter-row { padding: 0 17px 19px; gap: 10px; }
  .filter-row .segments { gap: 3px; }
  .filter-row .segments button { padding: 7px 9px; min-height: 36px; font-size: 10px; }
  .result-count { font-size: 9px; }
  .product-table tbody { padding: 0 17px 17px; }
  .product-table tr { padding: 15px; gap: 14px 18px; }
  .product-table .row-actions .icon-btn { width: 43px; height: 41px; }
  .library-metrics { font-size: 10px; gap: 18px; flex-wrap: wrap; }
  .empty-state { padding: 38px 18px; }
  .empty-state h2 { font-size: 21px; }
  .planner-layout { margin-top: 20px; gap: 18px; }
  .planner-layout > .input-stack:last-child { display: flex; }
  .monthly-profit { padding: 23px; }
  .monthly-profit .profit-number { font-size: 48px; }
  .monthly-stat-grid { grid-template-columns: 1fr 1fr; gap: 18px; }
  .quick-values button { min-height: 42px; font-size: 12px; }
  .insight-stats { gap: 12px; margin-bottom: 20px; }
  .stat-card { padding: 17px; }
  .stat-card > div { font-size: 10px; min-height: 31px; }
  .stat-card > strong { font-size: 29px; margin-top: 13px; }
  .portfolio-card { padding: 19px 0 0; }
  .portfolio-card > .card-heading { padding: 0 17px; }
  .history-grid { grid-template-columns: 1fr; }
  .projection-card { padding: 20px; }
  .form-grid-three { grid-template-columns: 1fr; }
  .theme-options { gap: 10px; }
  .theme-preview { height: 70px; }
  .theme-option > span:last-child { font-size: 11px; min-height: 30px; }
  .toggle-row { min-height: 58px; }
  .toggle-label { font-size: 12px; }
  .currency-heading { flex-wrap: wrap; }
  .sources-list { display: block; }
  .backup-summary { justify-content: space-between; gap: 12px; }
  .backup-summary span { font-size: 10px; }
  .backup-summary strong { font-size: 27px; }
  .danger-zone { flex-direction: column; align-items: stretch; padding: 20px; gap: 18px; }
  .notice { padding: 13px 14px; font-size: 11px; }
  .toast { left: 50%; bottom: calc(151px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 430px; font-size: 11px; }
  .modal { width: 100%; max-width: 100%; max-height: calc(100dvh - 48px); margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .modal-heading { padding: 15px 18px; }
  .modal-heading h2 { font-size: 16px; }
  .modal-body { padding: 19px 18px calc(24px + env(safe-area-inset-bottom)); }
  .modal-actions { padding-top: 19px; gap: 10px; }
  .modal-actions > .btn { flex: 1; }
  .result-modal .profit-number { font-size: 56px; }
  .result-modal .profit-card, .result-modal .recommend-card { padding: 23px; }
  .result-modal .money-row { font-size: 12px; padding-top: 9px; padding-bottom: 9px; }
  .result-modal .profit-card .microcopy { font-size: 10px; }
  .result-modal .profit-label { font-size: 13px; }
  .result-modal .profit-meta > span { font-size: 11px; }
  .result-modal .profit-card-top .eyebrow { font-size: 9px; }
  .result-modal .recommend-card p { font-size: 12px; }
  .command-result { min-height: 51px; }
  .language-choice { padding: 13px 28px 13px 12px; }
  .language-choice > .icon { right: 8px; }
}
@media (max-width: 374px) {
  .language-button .icon { display: none; }
  .topbar { padding: 0 12px; }
  .page-container { padding-left: 12px; padding-right: 12px; }
  .mobile-brand strong { font-size: 15px; }
  .page-heading h1 { font-size: 28px; }
  .heading-actions .btn { padding: 10px 12px; }
  .product-toolbar > .product-symbol { display: none; }
  .product-toolbar { padding: 12px; }
  .mobile-profit-preview { padding: 13px; }
  .mobile-profit-preview .badge { font-size: 8px; }
  .mobile-profit-preview > div:last-child { gap: 5px; }
  .tabs { gap: 17px; }
  .tabs button { font-size: 10.5px; }
  .segments button { padding-left: 6px; padding-right: 6px; font-size: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .pricing-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .pricing-fields .input-wrap input { font-size: 21px; padding-right: 8px; }
  .pricing-fields .field small { font-size: 9px; }
  .form-grid .cpa-stat { margin-bottom: 10px; }
  .page-heading .btn { font-size: 10.5px; }
  .topbar-actions { gap: 1px; }
  .stat-card { padding: 15px; }
  .stat-card > strong { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  :root { color-scheme: light; --bg: white; --surface: white; --text: black; --muted: #333; --subtle: #555; --border: #ccc; --border-soft: #ddd; --positive: #185b41; --profit-bg: #f4f7f4; --profit-text: #333; }
  .sidebar, .topbar, .bottom-nav, .mobile-dock, .mobile-profit-preview, .heading-actions, .toast { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .page-container { padding: 0; }
  .result-rail { display: block; position: static; }
  .calculator-layout { grid-template-columns: 1fr 300px; }
  .card, .profit-card { break-inside: avoid; }
}
