@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f4f1ea;
  --bg-grad: radial-gradient(1200px 600px at 85% -10%, #e3efe7 0%, transparent 60%), radial-gradient(900px 500px at -10% 10%, #f6e8d6 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --surface-3: #efece4;
  --border: #e4dfd4;
  --border-strong: #cfc8b9;
  --text: #1d2320;
  --text-2: #4f5a55;
  --text-3: #5c6661;
  --accent: #0f7a5f;
  --accent-strong: #0a5e49;
  --accent-soft: #dcefe7;
  --accent-text: #ffffff;
  --danger: #b4342c;
  --danger-soft: #fbe6e3;
  --warn: #8a5a00;
  --warn-soft: #fdf0d6;
  --good: #0f7a5f;
  --bad: #b4342c;
  --shadow: 0 1px 2px rgba(40, 35, 20, .05), 0 8px 24px -12px rgba(40, 35, 20, .18);
  --shadow-lg: 0 2px 4px rgba(40, 35, 20, .06), 0 24px 48px -20px rgba(40, 35, 20, .28);
  --ring: 0 0 0 3px rgba(15, 122, 95, .28);
  --c0: #0f7a5f;
  --c1: #d9822b;
  --c2: #3d6fd6;
  --c3: #c0457a;
  --c4: #7a5cc7;
  --c5: #2f9fb0;
  --c6: #b39213;
  --c7: #8b6a4e;
  --c8: #5f8f2f;
  --c9: #6b7280;
  --hero-from: #138a6b;
  --hero-to: #0a5442;
  --hero-text: #ffffff;
  --radius: 18px;
  --radius-sm: 12px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101513;
  --bg-grad: radial-gradient(1200px 600px at 85% -10%, #15302a 0%, transparent 60%), radial-gradient(900px 500px at -10% 10%, #2a2216 0%, transparent 55%);
  --surface: #171e1b;
  --surface-2: #1c2421;
  --surface-3: #232c29;
  --border: #2a3430;
  --border-strong: #3b4843;
  --text: #ecf1ee;
  --text-2: #b5c0bb;
  --text-3: #9ba7a2;
  --accent: #3fc79e;
  --accent-strong: #66d8b4;
  --accent-soft: #173a30;
  --accent-text: #08231b;
  --danger: #ff8a80;
  --danger-soft: #3a1d1b;
  --warn: #f3c46b;
  --warn-soft: #3a2e14;
  --good: #3fc79e;
  --bad: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -20px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(63, 199, 158, .35);
  --c0: #3fc79e;
  --c1: #f0a04b;
  --c2: #7aa2ff;
  --c3: #f07aa8;
  --c4: #b39cff;
  --c5: #5fd0de;
  --c6: #e3c548;
  --c7: #c9a184;
  --c8: #9ccc65;
  --c9: #9aa3ad;
  --hero-from: #1d7a60;
  --hero-to: #0f3f33;
  --hero-text: #f2fbf7;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513;
    --bg-grad: radial-gradient(1200px 600px at 85% -10%, #15302a 0%, transparent 60%), radial-gradient(900px 500px at -10% 10%, #2a2216 0%, transparent 55%);
    --surface: #171e1b;
    --surface-2: #1c2421;
    --surface-3: #232c29;
    --border: #2a3430;
    --border-strong: #3b4843;
    --text: #ecf1ee;
    --text-2: #b5c0bb;
    --text-3: #9ba7a2;
    --accent: #3fc79e;
    --accent-strong: #66d8b4;
    --accent-soft: #173a30;
    --accent-text: #08231b;
    --danger: #ff8a80;
    --danger-soft: #3a1d1b;
    --warn: #f3c46b;
    --warn-soft: #3a2e14;
    --good: #3fc79e;
    --bad: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 48px -20px rgba(0, 0, 0, .7);
    --ring: 0 0 0 3px rgba(63, 199, 158, .35);
    --c0: #3fc79e;
    --c1: #f0a04b;
    --c2: #7aa2ff;
    --c3: #f07aa8;
    --c4: #b39cff;
    --c5: #5fd0de;
    --c6: #e3c548;
    --c7: #c9a184;
    --c8: #9ccc65;
    --c9: #9aa3ad;
    --hero-from: #1d7a60;
    --hero-to: #0f3f33;
    --hero-text: #f2fbf7;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .06em; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { max-width: 1280px; margin: 0 auto; padding: 20px 16px 120px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 44px; height: 44px; flex: none; }
.bm-box { fill: var(--accent); }
.bm-lid { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.bm-lines { stroke: var(--accent-text); stroke-width: 3; stroke-linecap: round; }
.brand-text h1 { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.product-name input {
  border: 0; background: transparent; padding: 0; margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em;
  width: min(60vw, 520px); border-bottom: 2px dashed transparent; border-radius: 0;
}
.product-name input:hover { border-bottom-color: var(--border-strong); }
.product-name input:focus { outline: none; border-bottom-color: var(--accent); }
.top-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .segmented button:focus-visible, .tab:focus-visible, .hint:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-soft { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.btn-soft[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.icon-btn svg, .icon-only svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-only { min-width: 44px; min-height: 44px; padding: 0; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--text);
}
.banner-warn { background: var(--warn-soft); border-color: var(--warn); }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.variants { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: var(--surface-3); border-radius: 14px; max-width: 100%; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; white-space: nowrap;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab .tab-x { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-3); font-size: 12px; }
.tab .tab-x:hover { background: var(--surface-3); color: var(--danger); }
.tab .tab-cost { font-size: 12px; color: var(--text-3); font-weight: 600; }
.tabs-actions { display: flex; gap: 8px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 20px; align-items: start; }
.inputs { display: grid; gap: 16px; min-width: 0; }
.results { position: sticky; top: 16px; display: grid; gap: 16px; min-width: 0; max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px 6px 2px 2px; margin: -2px -6px -2px -2px; border-radius: var(--radius); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); min-width: 0;
}
.card.wide { margin-top: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head.row { justify-content: space-between; flex-wrap: wrap; }
.row-left { display: flex; align-items: center; gap: 10px; }
.card-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); flex: none; position: relative; }
.card-icon::after { content: ""; position: absolute; inset: 7px; border-radius: 4px; background: var(--accent); }
.ic-product::after { border-radius: 50%; }
.ic-pack::after { inset: 6px 8px; border-radius: 3px 3px 6px 6px; }
.ic-mat::after { inset: 8px 6px; border-radius: 2px; }
.ic-lines::after { inset: 8px; border-radius: 1px; box-shadow: 0 -4px 0 -2px var(--accent), 0 4px 0 -2px var(--accent); background: transparent; border-top: 2px solid var(--accent); }
.ic-tax::after { inset: 7px; border-radius: 50%; background: transparent; border: 3px solid var(--accent); }
.ic-price::after { inset: 7px 9px; border-radius: 3px; transform: rotate(45deg); }
.ic-batch::after { inset: 6px; border-radius: 4px; background: transparent; border: 3px dashed var(--accent); }
.ic-compare::after { inset: 7px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) 0 35%, transparent 35% 65%, var(--accent) 65%); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }

.field { display: grid; gap: 6px; margin-bottom: 12px; min-width: 0; align-content: start; }
.field label, .field .label { min-height: 20px; }
.grid-2 .field, .grid-3 .field { margin-bottom: 0; }
.grid-2 + .field, .grid-2 + .check { margin-top: 12px; }
.field label, .field .label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.input-wrap {
  display: flex; align-items: center; min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s, background .15s; overflow: hidden;
}
.input-wrap:focus-within { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.input-wrap input, .input-wrap select {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 12px; font-size: 16px; font-weight: 600; outline: none;
}
.input-wrap select { cursor: pointer; font-weight: 600; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.input-wrap select option { background: var(--surface); color: var(--text); }
.input-wrap.with-select select { flex: none; width: auto !important; border-left: 1px solid var(--border); font-size: 14px; color: var(--text-2); }
.unit { padding: 0 12px 0 0; color: var(--text-3); font-size: 13px; font-weight: 600; white-space: nowrap; }
.field.invalid .input-wrap { border-color: var(--danger); background: var(--danger-soft); }
.field-error { font-size: 12.5px; color: var(--danger); font-weight: 600; }
.field-note { font-size: 12.5px; color: var(--text-3); margin: 0; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; margin: 2px 0 0; --pct: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--pct), var(--surface-3) var(--pct)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: var(--shadow); transition: transform .15s; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip-add { border-style: dashed; background: transparent; }
.add-lines { margin-top: 12px; }
.presets { margin-bottom: 14px; }
.chip-add + .field { margin-top: 16px; }
.tax-list:empty { margin: 0; }
.subhead { margin-top: 18px; }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; min-height: 36px; margin-bottom: 10px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--ring); }
.switch.small { margin: 0; min-height: 44px; }
.switch.small .switch-ui { width: 36px; height: 20px; }
.switch.small .switch-ui::after { width: 14px; height: 14px; }
.switch.small input:checked + .switch-ui::after { transform: translateX(16px); }

.vat-off .vat-only { display: none !important; }
.no-monthly .needs-monthly, .no-rate .needs-rate { display: none; }
.no-revenue-tax .has-revenue-tax, .no-profit-tax .has-profit-tax { display: none; }

.hint {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; padding: 0;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-3); font-size: 11px; font-weight: 800; cursor: help; line-height: 1;
  position: relative;
}
.hint::before { content: ""; position: absolute; inset: -13px; }
.hint:hover { color: var(--accent-strong); border-color: var(--accent); }
.tooltip {
  position: fixed; z-index: 50; max-width: 300px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); pointer-events: none;
  left: var(--tx, 0); top: var(--ty, 0); animation: pop .15s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.subhead { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-2); margin: 14px 0 8px; }

.lines { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.line, .tax-row { min-width: 0; }
.input-wrap select { width: 100%; }
.line { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); padding: 6px 10px 10px; transition: opacity .2s, border-color .2s; }
.line.off { opacity: .55; }
.line.off .line-body { display: none; }
.line-head { display: flex; align-items: center; gap: 8px; }
.line-name { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 700; font-size: 15px; padding: 8px 4px; border-radius: 8px; }
.line-name:focus { outline: none; background: var(--surface); box-shadow: var(--ring); }
.line-cost { font-size: 13px; font-weight: 700; color: var(--accent-strong); white-space: nowrap; background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
.line-cost:empty { display: none; }
.line-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px 12px; padding-top: 4px; }
.line-body > .field { margin: 0; }
.line-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.line-values .field { margin: 0; }
.line-vat { grid-column: 1 / -1; }

.tax-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tax-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.tax-row .field { margin: 0; }
.tax-name { min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 8px 12px; font-weight: 600; min-width: 0; }
.tax-name:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.disclaimer { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; }

.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-3); gap: 2px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .segmented { margin-bottom: 0; }
.segmented button { min-height: 36px; padding: 6px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer; transition: all .15s; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented.small button { min-height: 32px; padding: 4px 10px; font-size: 13px; }

.card.result-card { padding: 0; overflow: hidden; }
.hero { padding: 20px 20px 16px; background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%); color: var(--hero-text); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 70%); pointer-events: none; }
.hero-label { font-size: 13px; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .07em; }
.hero-value { display: flex; align-items: baseline; gap: 8px; font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 4px; }
.hero-value .cur { font-size: 20px; font-weight: 700; opacity: .8; }
.hero-sub { font-size: 13px; opacity: .85; margin-top: 4px; min-height: 18px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.kpi { padding: 14px 20px; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { font-size: 12.5px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.kpi-value small, .price-row small, .profit-value small { font-size: 13px; color: var(--text-3); font-weight: 600; }
.price-block { padding: 14px 20px 18px; display: grid; gap: 6px; }
.price-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.price-row span { display: inline-flex; align-items: center; gap: 6px; }
.price-row strong { color: var(--text); font-weight: 700; white-space: nowrap; }
.price-row.main { font-size: 15px; }
.price-row.main strong { font-size: 18px; }
.profit-line { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--border-strong); flex-wrap: wrap; }
.profit-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.profit-value.neg { color: var(--bad); }
.profit-value.pos { color: var(--good); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent-strong); }
.badge.neg { background: var(--danger-soft); color: var(--danger); }
.badge-soft { background: var(--surface-3); color: var(--text-2); }
.alert { margin: 0 20px 18px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13.5px; font-weight: 600; }
.alert ul { margin: 0; padding-left: 18px; }
.batch .alert { margin: 0 0 12px; }
.alert.info { background: var(--warn-soft); color: var(--warn); }

.chart-wrap { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: center; }
.donut { width: 100%; max-width: 190px; display: block; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 26; }
.donut-seg { fill: none; stroke-width: 26; transition: stroke-dasharray .45s cubic-bezier(.2, .8, .2, 1), stroke-dashoffset .45s cubic-bezier(.2, .8, .2, 1), stroke-width .15s, opacity .15s; cursor: pointer; }
.donut.hovering .donut-seg { opacity: .35; }
.donut.hovering .donut-seg.active { opacity: 1; stroke-width: 32; }
.donut-total { text-anchor: middle; font-size: 24px; font-weight: 800; fill: var(--text); letter-spacing: -.02em; }
.donut-caption { text-anchor: middle; font-size: 11.5px; font-weight: 600; fill: var(--text-3); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 8px; font-size: 13px; cursor: default; transition: background .15s; }
.legend li.active { background: var(--surface-3); }
.legend .dot { width: 12px; height: 12px; border-radius: 4px; }
.legend .lname { overflow-wrap: anywhere; color: var(--text-2); font-weight: 600; line-height: 1.25; }
.legend .lval { font-weight: 700; white-space: nowrap; }
.legend .lpct { color: var(--text-3); font-size: 12px; width: 44px; text-align: right; }
.legend .empty { grid-template-columns: 1fr; color: var(--text-3); }
.s0 { stroke: var(--c0); background: var(--c0); } .s1 { stroke: var(--c1); background: var(--c1); } .s2 { stroke: var(--c2); background: var(--c2); }
.s3 { stroke: var(--c3); background: var(--c3); } .s4 { stroke: var(--c4); background: var(--c4); } .s5 { stroke: var(--c5); background: var(--c5); }
.s6 { stroke: var(--c6); background: var(--c6); } .s7 { stroke: var(--c7); background: var(--c7); } .s8 { stroke: var(--c8); background: var(--c8); }
.s9 { stroke: var(--c9); background: var(--c9); }

.pack-card { padding: 14px 16px; }
.pack-svg { width: 100%; height: auto; display: block; }
.pack-caption { text-align: center; font-size: 13.5px; color: var(--text-2); font-weight: 600; margin-top: 4px; }
.ps-bag { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; transition: all .35s; }
.ps-zip { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 4 3; }
.ps-label { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.ps-grams { font-size: 17px; font-weight: 800; fill: var(--text); text-anchor: middle; }
.ps-kind { font-size: 9px; font-weight: 700; fill: var(--text-3); text-anchor: middle; letter-spacing: .1em; }
.ps-box-front { fill: var(--surface-2); stroke: var(--c1); stroke-width: 2.5; stroke-linejoin: round; }
.ps-box-top { fill: var(--surface-3); stroke: var(--c1); stroke-width: 2.5; stroke-linejoin: round; }
.ps-box-side { fill: var(--surface-3); stroke: var(--c1); stroke-width: 2.5; stroke-linejoin: round; opacity: .8; }
.ps-cell { fill: var(--accent); opacity: .85; transition: opacity .3s; }
.ps-more { font-size: 12px; font-weight: 800; fill: var(--text-2); text-anchor: middle; }
.ps-arrow { stroke: var(--text-3); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ps-times { font-size: 15px; font-weight: 800; fill: var(--text-2); text-anchor: middle; }

.whatif { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.whatif li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; font-size: 14px; }
.whatif .wname { font-weight: 600; color: var(--text-2); }
.whatif .wval { font-weight: 800; white-space: nowrap; }
.whatif .up { color: var(--bad); }
.whatif .down { color: var(--good); }
.whatif .wm { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.whatif .na { color: var(--text-3); font-weight: 600; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; white-space: normal; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .total td { font-weight: 800; border-top: 2px solid var(--border-strong); border-bottom: 0; }
.table .muted td { color: var(--text-3); font-size: 13px; }
.table .sub td:first-child { padding-left: 22px; color: var(--text-2); }
.table .pos { color: var(--good); }
.table .neg { color: var(--bad); }
.compare .best td { background: var(--accent-soft); }
.compare .best td:first-child { font-weight: 800; }
.compare .active-v td:first-child::after { content: " •"; color: var(--accent); }

.batch-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: start; margin-bottom: 12px; }
.batch-controls .field { margin: 0; }
.batch-controls .segmented { margin: 0; }
.batch .mode-raw { display: none; }
.batch.raw .mode-raw { display: grid; }
.batch.raw .mode-boxes { display: none; }
.more { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; background: var(--surface-2); }
.more summary { cursor: pointer; font-weight: 700; color: var(--text-2); padding: 12px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "›"; display: inline-block; transition: transform .2s; font-size: 18px; line-height: 1; }
.more[open] summary::before { transform: rotate(90deg); }
.more[open] { padding-bottom: 12px; }
.more .field-note { margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.stat { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.stat .kpi-label { font-size: 11.5px; }
.stat .sv { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .sv small { font-size: 12px; color: var(--text-3); font-weight: 600; }
.stat .ss { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat.accent { background: var(--accent-soft); border-color: transparent; }
.stat.accent .sv { color: var(--accent-strong); }
.batch-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 24px; }
.batch-grid .btn { margin-top: 12px; }

.footer { margin-top: 28px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-3); font-size: 13px; }
.footer p { margin: 0; max-width: 640px; }

.mobilebar { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.flash { animation: flash .6s ease-out; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

@media (max-width: 1020px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .results { position: static; max-height: none; overflow: visible; padding: 0; margin: 0; }
  .chart-wrap { grid-template-columns: 180px minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .app { padding: 14px 16px 110px; }
  .brand-mark { width: 36px; height: 36px; }
  .product-name input { font-size: 21px; width: 70vw; }
  .top-actions { width: 100%; justify-content: space-between; }
  .top-actions .icon-btn span { display: none; }
  .top-actions .icon-btn { min-width: 44px; min-height: 44px; padding: 0 10px; }
  .variants { flex-direction: column; align-items: stretch; }
  .tabs-actions { justify-content: stretch; }
  .tabs-actions .btn { flex: 1; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-body { grid-template-columns: minmax(0, 1fr); }
  .tax-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .card { padding: 16px; }
  .hero-value { font-size: 40px; }
  .chart-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .legend { width: 100%; }
  .batch-grid { grid-template-columns: minmax(0, 1fr); }
  .mobilebar {
    display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, .25);
  }
  .mb-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
  .mb-value { font-size: 16px; font-weight: 800; white-space: nowrap; }
  .toast { bottom: 90px; }
}

@media (max-width: 400px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .mobilebar { grid-template-columns: 1fr 1fr auto; }
  .mobilebar > div:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #f1f1f1; --text: #000; --text-2: #222; --text-3: #555; --border: #ccc; --accent: #0f7a5f; --accent-strong: #0a5e49; --accent-text: #fff; --accent-soft: #e6f2ed; }
  body { background: #fff; font-size: 12px; }
  .app { padding: 0; max-width: none; }
  .top-actions, .variants, .inputs, .mobilebar, .banner, .footer-actions, .tooltip, .toast, .pack-card, .whatif-card, #copyBatch, .batch-controls, .hint, .segmented { display: none !important; }
  .layout { display: block; }
  .results { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { box-shadow: none; break-inside: avoid; padding: 12px; }
  .hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .product-name input { font-size: 20px; }
  .batch-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .compare.hidden { display: none !important; }
  .footer { margin-top: 12px; }
  @page { size: A4; margin: 12mm; }
}
