/* Аяулы Жүсіп — салық құралдары */
:root {
  --bg: #f4f9f1;
  --surface: #ffffff;
  --ink: #13301b;
  --ink-2: #35503b;
  --muted: #55705a;
  --line: #e2eedb;
  --line-2: #cadfbf;
  --blue: #358229;
  --blue-600: #2a6b21;
  --blue-50: #eff8ea;
  --blue-100: #d6edcb;
  --navy: #1f5a26;
  --royal: #2a6b21;
  --sky: #a8d98f;
  --leaf: #8ccf5e;
  --amber: #e08a1e;
  --script: "Great Vibes", "Segoe Script", cursive;
  --warn: #b45309;
  --warn-bg: #fff6e8;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-lg: 22px;
  --r-md: 14px;
  --wrap: 1240px;
  --gut: 32px;
  --top-h: 64px;
  --tabs-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.16, 1, .3, 1);
  --shadow: 0 1px 2px rgba(19, 48, 27, .05);
  --cur: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Cpath d='M4 2.5v18.2l4.7-4.4 3.2 7.1 3-1.3-3.1-6.9h6.6z' fill='%232a6b21' stroke='%23fff' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") 4 3, auto;
  --cur-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M10 13.5V5a2 2 0 0 1 4 0v7.5V10.6a2 2 0 0 1 4 0V13a2 2 0 0 1 4 0v4a8 8 0 0 1-8 8h-1.6c-2.6 0-4.2-.8-5.6-2.2L3.4 19.4a2 2 0 0 1 2.8-2.8L10 20' fill='%232a6b21' stroke='%23fff' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 11 3, pointer;
}

*, *::before, *::after { box-sizing: border-box; }
/* brand cursor and scrollbar */
html { cursor: var(--cur); scrollbar-color: var(--blue) var(--bg); }
a, label, summary, select, [role="tab"], [role="button"] { cursor: var(--cur-hand); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, [contenteditable] { cursor: text; }
@supports selector(::-webkit-scrollbar) {
  html { scrollbar-color: auto; }
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: var(--blue); border: 3px solid var(--bg); border-radius: 999px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--navy); }
  ::-webkit-scrollbar-corner { background: var(--bg); }
}
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; scroll-behavior: smooth; scroll-padding-top: calc(var(--top-h) + var(--tabs-h) + 12px); }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, h4, b, strong { font-weight: 500; }
.row__val, .facts b, .result__value, .stat b, .dock__txt b, .dtot b, .input input { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { cursor: var(--cur-hand); }
/* touch: no double-tap delay on controls, no text selection or callout when a control is held */
button, a, label, summary, select, [role="button"], [role="tab"] { touch-action: manipulation; }
button, [role="button"], [role="tab"], label, summary { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); }
.skip { position: absolute; left: 16px; top: -60px; z-index: 80; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 40; height: var(--top-h); background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.top__row { display: flex; align-items: center; gap: 10px; height: 100%; }
.brand { display: inline-flex; align-items: baseline; gap: 6px; margin-right: auto; padding: 2px 4px; border-radius: 10px; text-decoration: none; color: var(--ink-2); }
.brand__a { font-size: 19px; font-weight: 300; letter-spacing: .01em; }
.brand__b { font-family: var(--script); font-size: 31px; line-height: 1; color: var(--navy); transform: translateY(3px); }
.is-ready .brand__b { animation: ink 1.2s var(--spring) .2s backwards; }
@keyframes ink { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.top__tools { display: flex; gap: 6px; }
.tool { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; font-weight: 500; color: var(--ink-2); transition: border-color .2s, color .2s, background .2s, transform .15s; }
.tool svg { width: 18px; height: 18px; color: var(--blue); }
.tool:active { transform: scale(.97); }

.lang { position: relative; display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang__btn { position: relative; z-index: 1; border: 0; background: none; height: 36px; min-width: 52px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; letter-spacing: .04em; color: var(--muted); transition: color .25s; }
.lang__btn[aria-pressed="true"] { color: #fff; }
.lang__pill { position: absolute; top: 3px; left: 3px; height: 36px; border-radius: 999px; background: var(--royal); transition: transform .45s var(--spring), width .45s var(--spring); }

/* ---------- hero ---------- */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: center; gap: 24px; padding-top: 18px; padding-bottom: 6px; }
.hero__text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--blue); }
.sig { position: relative; display: flex; flex-direction: column; margin: 2px 0 6px; line-height: .9; }
.sig__a { font-size: clamp(34px, 4.4vw, 58px); font-weight: 300; letter-spacing: -.01em; color: #2f4a33; }
.sig__b { margin: -.4em -.15em -.06em .05em; font-family: var(--script); font-size: clamp(66px, 8.4vw, 116px); line-height: 1; color: var(--navy); padding: .35em .25em .14em .4em; }
.sig__wave { width: min(440px, 80%); height: 26px; margin: -10px 0 0 1.2em; fill: none; stroke: #a8d98f; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 600; stroke-dashoffset: 600; }
.is-ready .sig__wave { animation: draw 1.6s var(--ease) .5s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
h1 { margin: 0; max-width: 34ch; font-size: clamp(19px, 1.9vw, 25px); line-height: 1.25; letter-spacing: -.015em; font-weight: 500; text-wrap: balance; color: var(--ink); }
.lead { margin: 0; max-width: 60ch; font-size: 15.5px; color: var(--ink-2); text-wrap: pretty; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 0; padding: 0; list-style: none; }
.facts li { display: flex; align-items: baseline; gap: 10px; padding: 8px 14px; background: rgba(255, 255, 255, .8); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); white-space: nowrap; backdrop-filter: blur(6px); }
.facts b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.facts b span { font-weight: 500; }

.hero__art { position: relative; height: 380px; }
.blob { position: absolute; border-radius: 50%; pointer-events: none; }
.blob--1 { width: 330px; height: 330px; right: -10px; top: 26px; background: #d5ebc8; }
.blob--2 { width: 170px; height: 170px; left: 8px; bottom: 6px; background: #e5f2de; }
.blob--3 { width: 90px; height: 90px; right: 6px; top: 0; border: 2px solid #c4e4b3; background: rgba(255, 255, 255, .5); }
.leafs { position: absolute; left: -4px; bottom: 20px; width: 120px; height: 170px; fill: none; stroke: #a9d493; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.portrait { position: absolute; left: 50%; bottom: 0; width: 262px; height: 340px; margin-left: -116px; overflow: hidden; border-radius: 140px 140px 30px 30px; border: 6px solid #fff; background: #e3f0dc; box-shadow: none; }
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(4deg); } }
.is-ready .hero__art .portrait { animation: rise .9s var(--spring) .15s both; }

[data-enter] > * { opacity: 0; transform: translateY(12px); }
.is-ready [data-enter] > * { animation: rise .7s var(--spring) both; }
.is-ready [data-enter] > *:nth-child(2) { animation-delay: .05s; }
.is-ready [data-enter] > *:nth-child(3) { animation-delay: .1s; }
.is-ready [data-enter] > *:nth-child(4) { animation-delay: .15s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- tabs ---------- */
.tabs-wrap { position: sticky; top: var(--top-h); z-index: 30; background: rgba(244, 249, 241, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid transparent; transition: border-color .25s; }
.tabs-wrap.is-stuck { border-bottom-color: var(--line); }
.tabs { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
.tabs__row { position: relative; display: flex; align-items: center; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; }
.tabs__row::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .tabs__row { flex-wrap: wrap; overflow: visible; } }

/* services row: Kaspi + documents stand apart from the calculators */
.tabs__row--svc { gap: 10px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.svc-label { display: inline-flex; align-items: center; gap: 6px; flex: none; margin-right: 4px; font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--blue); }
.tab--svc { gap: 10px; min-height: 54px; padding: 6px 14px 6px 7px; border: 1.5px solid #cbe7bb; border-radius: 14px; background: #fff; box-shadow: none; }
.tab--svc .tab__ic { display: grid; place-items: center; width: 28px; height: 28px; }
.tab--svc .tab__ic svg { width: 22px; height: 22px; color: var(--blue); }
.tab__txt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.15; }
.tab__txt b { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.tab__txt small { font-size: 12px; font-weight: 500; color: var(--muted); }
.tab--svc[aria-selected="true"] { background: var(--royal); border-color: transparent; }
.tab--svc[aria-selected="true"] .tab__ic svg { color: #fff; }
.tab--svc[aria-selected="true"] .tab__txt b { color: #fff; }
.tab--svc[aria-selected="true"] .tab__txt small { color: #d4f0c4; }
@media (max-width: 899px) {
  .tabs {
    flex-direction: row; align-items: center; gap: 6px; padding-top: 8px; padding-bottom: 8px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: var(--gut); scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs__row { flex: none; overflow: visible; scroll-snap-type: none; }
  .tabs__row--svc { gap: 6px; padding-left: 10px; margin-left: 4px; padding-top: 0; border-top: 0; border-left: 1px solid var(--line-2); }
  .tabs .tab { scroll-snap-align: start; }
  .svc-label { display: none; }
  .tab--svc { min-height: 46px; padding: 4px 12px 4px 5px; }
  .tab--svc .tab__ic { display: grid; place-items: center; width: 28px; height: 28px; }
  .tab__txt small { display: none; }
}
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 44px; padding: 0 14px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; scroll-snap-align: start; transition: background .2s, color .2s, border-color .2s, transform .15s; }
.tab svg { width: 19px; height: 19px; color: var(--muted); transition: color .2s; }
.tab[aria-selected="true"] { background: var(--royal); border-color: transparent; color: #fff; box-shadow: none; }
.tab[aria-selected="true"] svg { color: #d4f0c4; }
.tab:active { transform: scale(.97); }
.tab__sep { flex: none; width: 1px; height: 24px; margin: 0 4px; background: var(--line-2); }

/* ---------- app grid ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; padding-top: 16px; padding-bottom: 64px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 26px; min-width: 0; }
.panel__head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.panel__icon { display: grid; place-items: center; width: 28px; height: 28px; color: var(--blue); flex: none; }
.panel__icon svg { width: 26px; height: 26px; }
.panel__head > div:nth-child(2) { flex: 1; min-width: 0; }
.panel h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; }
.panel__sub { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
.ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; color: var(--ink-2); transition: border-color .2s, color .2s, transform .15s; }
.ghost svg { width: 16px; height: 16px; transition: transform .5s var(--spring); }
.ghost:active { transform: scale(.97); }
.panel.is-switching .form, .panel.is-switching .panel__head { animation: swap .4s var(--spring); }
@keyframes swap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- form ---------- */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field[hidden], .kicker[hidden], .toggle[hidden] { display: none; }
.label { display: flex; align-items: center; gap: 4px; min-height: 22px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.label .info-btn { width: 30px; height: 30px; margin: -6px 0; }
.hint { font-size: 13px; color: var(--muted); }
.kicker { margin: 6px 0 -4px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--blue-600); }
.kicker:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.input { position: relative; display: flex; align-items: center; }
.input input, .input select {
  width: 100%; height: 52px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; transition: border-color .2s, box-shadow .2s; appearance: none; -webkit-appearance: none;
}
.input select { padding-right: 42px; cursor: var(--cur-hand); text-overflow: ellipsis; }
.input--money input, .input--suffix input { padding-right: 46px; }
.input .suffix { position: absolute; right: 16px; color: var(--muted); font-weight: 500; pointer-events: none; }
.input .caret { position: absolute; right: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input input:focus, .input select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-100); }
.input input[type="date"] { font-size: 16px; }
.input--sm input, .input--sm select, .toggle__extra .input--money input { height: 46px; font-size: 16px; border-radius: 12px; }
.toggle__extra .input--money input::placeholder { font-size: 14px; font-weight: 400; color: var(--muted); }

.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-auto-rows: minmax(44px, auto); padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); isolation: isolate; }
.seg button { position: relative; z-index: 1; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 10px; background: none; font-size: 14px; font-weight: 500; line-height: 1.25; color: var(--muted); transition: color .25s; }
.seg button[aria-pressed="true"] { color: var(--ink); font-weight: 500; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg__pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; border-radius: 10px; background: var(--surface); box-shadow: 0 1px 2px rgba(19, 48, 27, .08), 0 2px 8px -2px rgba(19, 48, 27, .12); transition: transform .4s var(--spring), width .4s var(--spring); }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color .2s, background .2s; }
.toggle.is-on { border-color: var(--blue-100); background: #f6fbf3; }
.toggle.is-disabled { opacity: .5; }
.toggle__row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 6px 6px 12px; }
.toggle__row label { flex: 1; font-size: 14.5px; font-weight: 500; line-height: 1.3; cursor: var(--cur-hand); padding: 6px 0; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: -9px -4px; margin: 0; opacity: 0; cursor: var(--cur-hand); z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .25s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .35s var(--spring); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.info-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); flex: none; transition: color .2s, background .2s; }
.info-btn svg { width: 18px; height: 18px; }
.info-btn[aria-expanded="true"] { color: var(--blue); background: var(--blue-50); }
.toggle__info { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--spring); }
.toggle__info > p { overflow: hidden; margin: 0; padding: 0 12px; font-size: 13.5px; color: var(--ink-2); white-space: pre-line; }
.toggle__info.is-open { grid-template-rows: 1fr; }
.toggle__info.is-open > p { padding-bottom: 12px; }
.field > .toggle__info > p { padding: 0 2px; }
.toggle__extra { padding: 0 10px 10px; }
.toggle:not(.is-on) .toggle__extra { display: none; }
.toggle.is-on .toggle__extra { animation: swap .35s var(--spring); }

.accr { display: flex; flex-direction: column; gap: 10px; }
.accr__row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 46px; gap: 8px; align-items: center; animation: swap .35s var(--spring); }
.accr__row select { font-size: 16px; }
.icon-btn { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); transition: color .2s, border-color .2s, background .2s, transform .15s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active:not(:disabled) { transform: scale(.94); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.add-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 2px; padding: 0 16px; border: 1.5px dashed var(--blue-100); border-radius: 12px; background: #f6fbf3; color: var(--blue-600); font-size: 14px; font-weight: 500; transition: background .2s, border-color .2s; }
.add-btn svg { width: 16px; height: 16px; transition: transform .4s var(--spring); }

/* ---------- result ---------- */
.result { align-self: stretch; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.result__grip { display: none; }
.result__card { position: sticky; top: calc(var(--top-h) + var(--tabs-h) + 12px); z-index: 3; flex: none; overflow: hidden; padding: 22px 22px 20px; border-radius: var(--r-lg); background: var(--royal); color: #fff; box-shadow: none; }
.result__card::before { content: ""; position: absolute; left: -60px; bottom: -150px; width: 300px; height: 220px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .14); pointer-events: none; }
.result__label { position: relative; z-index: 1; margin: 0; font-size: 14px; color: rgba(255, 255, 255, .72); }
.result__value { position: relative; z-index: 1; display: flex; align-items: baseline; gap: 8px; margin: 4px 0 2px; font-size: clamp(32px, 3vw, 42px); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result__value .cur { font-size: .55em; font-weight: 500; color: rgba(255, 255, 255, .6); }
.result__meta { position: relative; z-index: 1; margin: 0; min-height: 21px; font-size: 14px; color: rgba(255, 255, 255, .68); }
.result__value.bump { animation: bump .5s var(--spring); }
@keyframes bump { 30% { transform: scale(1.025); } }
.bar { position: relative; z-index: 1; display: flex; height: 10px; margin-top: 16px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .1); gap: 2px; }
.bar span { height: 100%; min-width: 0; transition: flex-grow .7s var(--spring); flex-basis: 0; }
.legend { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: rgba(255, 255, 255, .75); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }
.legend b { color: #fff; font-weight: 500; font-variant-numeric: tabular-nums; }
.c0 { background: #5b8cff; } .c1 { background: #ffffff; } .c2 { background: #93b4ff; } .c3 { background: #2fd2a5; }
.c4 { background: #ffc46b; } .c5 { background: #ff8a8a; } .c6 { background: #b8c6e3; } .c7 { background: #6be1ff; } .c8 { background: #e2a8ff; }

.result__scroll { display: flex; flex-direction: column; gap: 12px; }
.result__scroll::-webkit-scrollbar { width: 6px; }
.result__scroll::-webkit-scrollbar-thumb { background: var(--blue); border: 0; border-radius: 3px; }
.result__body { display: flex; flex-direction: column; gap: 12px; }
.group { padding: 6px 18px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.group h3 { margin: 10px 0 2px; font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.group h3 + .row { border-top: 0; }
.row__name { display: flex; flex-direction: column; min-width: 0; }
.row__name b { font-size: 15px; font-weight: 500; }
.row__name small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.row__val { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row__val.zero { color: var(--muted); font-weight: 500; }
.row--total { border-top: 1.5px solid var(--ink); }
.row--total .row__name b, .row--total .row__val { font-size: 16.5px; }
.row--total .row__val { color: var(--blue-600); }

.cmp { display: grid; grid-template-columns: minmax(52px, auto) repeat(var(--cols), minmax(0, 1fr)); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.cmp > span { padding: 9px 4px; border-top: 1px solid var(--line); font-size: 13.5px; text-align: right; white-space: nowrap; }
.cmp > .cmp__h { border-top: 0; }
.cmp__h { font-size: 11.5px !important; font-weight: 500; color: var(--muted); white-space: normal !important; line-height: 1.25; align-self: end; }
.cmp__k { text-align: left !important; font-weight: 500; }
.cmp__v { font-weight: 500; }
.cmp__v.zero { color: var(--muted); }
.cmp__t { border-top: 1.5px solid var(--ink) !important; font-weight: 700; color: var(--blue-600); }
.cmp__k.cmp__t { color: var(--ink); }

.result__notes { display: flex; flex-direction: column; gap: 8px; }
.result__notes:empty { display: none; }
.note { display: flex; gap: 10px; margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--blue-50); color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.note svg { width: 18px; height: 18px; color: var(--blue); margin-top: 1px; }
.note--warn { background: var(--warn-bg); }
.note--warn svg { color: var(--warn); }

.btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 20px; border: 0; border-radius: var(--r-md); background: var(--royal); color: #fff; font-size: 15px; font-weight: 500; transition: background .2s, transform .15s var(--ease); }
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.98); }

/* dock + sheet (mobile) */
.dock, .sheet-backdrop { display: none; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 90; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; transform: translate(-50%, 140%); opacity: 0; transition: transform .45s var(--spring), opacity .3s; pointer-events: none; }
.toast svg { width: 18px; height: 18px; color: #6ee7b7; }
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot__row { display: flex; justify-content: space-between; gap: 24px; padding-top: 24px; padding-bottom: 24px; font-size: 13.5px; color: var(--muted); }
.foot p { margin: 0; max-width: 72ch; }
.foot__brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.foot__sig { font-family: var(--script); font-size: 26px; line-height: 1; color: var(--navy); }
.foot__credit { display: flex; justify-content: center; padding-top: 14px; padding-bottom: 22px; border-top: 1px dashed var(--line); }
.credit { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 999px; color: var(--muted); font-size: 13px; text-decoration: none; transition: background .2s, color .2s; }
.credit b { font-weight: 500; color: var(--ink); letter-spacing: .01em; }
.credit__ig { display: grid; place-items: center; width: 20px; height: 20px; color: var(--ink); }
.credit__ig svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.credit:hover { background: var(--blue-50, #eff8ea); color: var(--ink); }
.credit:hover b { color: var(--blue); }
.credit:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- dialogs ---------- */
.dlg { width: min(560px, calc(100vw - 32px)); max-height: min(860px, calc(100dvh - 48px)); padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(19, 48, 27, .45); overflow: hidden; }
.dlg[open] { display: flex; animation: dlgIn .45s var(--spring); }
.dlg.is-closing { animation: dlgOut .22s var(--ease) forwards; }
.dlg::backdrop { background: rgba(19, 48, 27, .42); backdrop-filter: blur(4px); animation: fade .3s ease; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes dlgOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.has-dialog, .sheet-open { overflow: hidden; }
.dlg__box { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.dlg__head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.dlg__head h2 { flex: 1; margin: 0; font-size: 20px; letter-spacing: -.02em; }
.dlg__ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--royal); color: #fff; flex: none; }
.dlg__body { padding: 18px 20px 24px; overflow-y: auto; overscroll-behavior: contain; }
.dlg__desc { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

.cal__up { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; margin: 0 -20px 16px; padding: 6px 20px 2px; scrollbar-width: none; }
.cal__up::-webkit-scrollbar { display: none; }
.up { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); transition: border-color .2s, transform .2s var(--ease); }
.up b { font-size: 20px; line-height: 1.1; }
.up span { font-size: 12px; color: var(--muted); }
.up small { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 500; line-height: 20px; }
.cal__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal__nav b { font-size: 17px; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal__w { padding: 4px 0; font-size: 13px; font-weight: 500; text-transform: none; color: var(--muted); }
.cal__d { position: relative; width: 100%; max-width: 48px; aspect-ratio: 1; margin: 0 auto; border: 0; border-radius: 50%; background: none; font-size: 15px; font-variant-numeric: tabular-nums; transition: background .2s, color .2s, transform .2s var(--spring); }
.cal__d.is-out { opacity: .35; }
.cal__d.is-today { box-shadow: inset 0 0 0 1.5px var(--blue); color: var(--blue-600); font-weight: 500; }
.cal__d.has-ev::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--blue); }
.cal__d.is-sel { background: var(--royal); color: #fff; transform: scale(1.04); }
.cal__d.is-sel::after { background: #fff; }
.cal__head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.cal__head b { font-size: 17px; }
.cal__head span { font-size: 13px; color: var(--muted); }
.cal__note { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.cal__note[hidden] { display: none; }
.cal__list { display: flex; flex-direction: column; gap: 8px; }
.cal__empty { margin: 0; color: var(--muted); font-size: 14px; }
.ev, .req { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .2s; }
.ev[open], .req[open] { border-color: var(--blue-100); }
.ev summary, .req summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px 10px 14px; cursor: var(--cur-hand); list-style: none; font-size: 14px; font-weight: 500; line-height: 1.35; }
.ev summary::-webkit-details-marker, .req summary::-webkit-details-marker { display: none; }
.ev summary span { flex: 1; }
.ev__c { width: 18px; height: 18px; color: var(--muted); transition: transform .35s var(--spring); }
details[open] > summary .ev__c { transform: rotate(180deg); }
.ev p { margin: 0; padding: 0 14px 14px; font-size: 13.5px; color: var(--ink-2); }
details[open] > summary ~ * { animation: swap .35s var(--spring); }
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req__ab { min-width: 64px; padding: 4px 8px; border-radius: 8px; background: var(--blue-50); color: var(--blue-600); font-size: 13px; text-align: center; }
.req__t { flex: 1; font-weight: 500; }
.req__body { padding: 0 14px 14px; }
.req__sel { display: grid; gap: 8px; margin-bottom: 12px; }
.req__dl { margin: 0; }
.req__dl > div { padding: 10px 0; border-top: 1px solid var(--line); }
.req__dl > div:first-child { border-top: 0; padding-top: 2px; }
.req__dl dt { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.req__dl dd { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 2px 0 0; font-size: 14.5px; white-space: pre-line; word-break: break-word; user-select: text; }
.copy-mini { display: grid; place-items: center; width: 40px; height: 40px; margin: -8px -8px 0 0; flex: none; border: 0; border-radius: 10px; background: none; color: var(--muted); transition: color .2s, background .2s; }
.copy-mini svg { width: 16px; height: 16px; }

/* ---------- hover only on real pointers ---------- */
@media (hover: hover) and (pointer: fine) {
  .tool:hover { border-color: var(--blue-100); color: var(--ink); background: var(--blue-50); }
  .lang__btn:hover:not([aria-pressed="true"]) { color: var(--ink); }
  .tab:hover:not([aria-selected="true"]) { border-color: var(--line-2); color: var(--ink); transform: translateY(-1px); }
  .ghost:hover { border-color: var(--line-2); color: var(--ink); }
  .ghost:hover svg { transform: rotate(-200deg); }
  .seg button:hover:not(:disabled) { color: var(--ink); }
  .input input:hover, .input select:hover { border-color: var(--line-2); }
  .info-btn:hover { color: var(--blue); background: var(--blue-50); }
  .icon-btn:hover:not(:disabled) { color: var(--blue); border-color: var(--blue-100); background: var(--blue-50); }
  .add-btn:hover { background: var(--blue-50); border-color: var(--blue); }
  .add-btn:hover svg { transform: rotate(90deg); }
  .btn:hover { background: var(--blue-600); transform: translateY(-1px); }
  .up:hover { border-color: var(--blue); transform: translateY(-2px); }
  .cal__d:hover:not(.is-sel) { background: var(--blue-50); }
  .copy-mini:hover { color: var(--blue); background: var(--blue-50); }
}

.seg button:active:not(:disabled), .lang__btn:active, .add-btn:active, .info-btn:active, .copy-mini:active, .cal__d:active, .up:active, .dock__btn:active { scale: .96; }

/* ---------- tablet & mobile ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr) 360px; }
  .hero { grid-template-columns: minmax(0, 1fr) 320px; }
  .hero__art { height: 330px; }
  .portrait { width: 222px; height: 292px; margin-left: -100px; }
  .blob--1 { width: 280px; height: 280px; }
}

@media (max-width: 899px) {
  :root { --gut: 16px; --top-h: 58px; --tabs-h: 62px; }
  .brand__a { font-size: 16px; }
  .brand__b { font-size: 26px; }
  .tool { width: 44px; padding: 0; justify-content: center; }
  .tool span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tool svg { width: 20px; height: 20px; }
  .lang__btn { min-width: 44px; padding: 0 9px; }

  .hero { display: block; padding-top: 14px; padding-bottom: 4px; }
  .hero__text { gap: 6px; }
  .eyebrow, .sig { padding-right: 124px; }
  .eyebrow { font-size: 10.5px; letter-spacing: .1em; }
  .sig__a { font-size: 30px; }
  .sig__b { font-size: 58px; margin-left: -.1em; }
  .sig__wave { height: 18px; margin-top: -8px; width: 70%; }
  h1 { font-size: 18px; max-width: none; }
  .lead { display: none; }
  .hero__art { position: absolute; right: var(--gut); top: 10px; width: 116px; height: 150px; }
  .blob--1 { width: 120px; height: 120px; right: -6px; top: 4px; }
  .blob--2, .blob--3, .leafs, .hero__chip--b { display: none; }
  .portrait { width: 100px; height: 132px; left: auto; right: 6px; margin: 0; border-width: 4px; border-radius: 60px 60px 18px 18px; }
  .hero__chip--a { width: 36px; height: 36px; left: -4px; top: 18px; font-size: 16px; border-radius: 12px; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 0; }
  .facts::-webkit-scrollbar { display: none; }
  .facts li { justify-content: space-between; padding: 6px 10px; font-size: 13px; border-radius: 10px; }

    .tab { min-height: 42px; padding: 0 12px 0 10px; font-size: 14px; border-radius: 11px; }

  .app { display: block; padding-top: 8px; padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .panel { padding: 18px 16px 20px; border-radius: 20px; }
  .panel__head { margin-bottom: 18px; gap: 12px; }
  .panel__icon { display: grid; place-items: center; width: 28px; height: 28px; color: var(--blue); flex: none; }
  .panel h2 { font-size: 19px; }
  .panel__sub { font-size: 13.5px; }
  .ghost span { display: none; }
  .ghost { width: 44px; padding: 0; }

  .form { gap: 14px 10px; }
  .form > .field:not(.field--half), .form > .kicker { grid-column: 1 / -1; }
  .toggles { grid-template-columns: 1fr; gap: 8px; }
  .accr__row { grid-template-columns: minmax(0, 1fr) 46px; }
  .accr__row .input--money { grid-column: 1; }
  .accr__row .icon-btn { grid-row: 1 / span 2; grid-column: 2; align-self: stretch; height: auto; }

  /* result as bottom sheet */
  .result {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 46; display: flex;
    max-height: calc(100dvh - var(--top-h) - 12px); padding: 8px 12px calc(96px + env(safe-area-inset-bottom));
    background: var(--bg); border-radius: 24px 24px 0 0; box-shadow: 0 -20px 50px -20px rgba(19, 48, 27, .45);
    transform: translateY(105%); visibility: hidden; transition: transform .45s var(--spring), visibility 0s linear .45s;
  }
  .sheet-open .result { transform: none; visibility: visible; transition: transform .45s var(--spring), visibility 0s; }
  .result__card { position: relative; top: auto; box-shadow: none; }
  .result__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .result { align-self: auto; }
  .result__grip { display: block; flex: none; width: 44px; height: 5px; margin: 2px auto 4px; border-radius: 3px; background: var(--line-2); }
  .result__card { padding: 18px; }
  .group { padding: 4px 14px 2px; }
  .btn { width: 100%; }
  .cmp > span { font-size: 12.5px; padding: 8px 2px; }

  .result.is-dragging { transition: none; }
  .result__grip { position: relative; }
  .result__grip::before { content: ""; position: absolute; inset: -14px -60px; } /* a thumb-sized handle around the thin bar */
  html.sheet-open { overflow: hidden; } /* the page behind the open sheet stays put */

  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(19, 48, 27, .4); opacity: 0; transition: opacity .3s; touch-action: none; }
  .sheet-backdrop[hidden] { display: none; }
  .sheet-open .sheet-backdrop { opacity: 1; }

  /* the header slides away while reading down and comes back on the first scroll up */
  .top, .tabs-wrap { transition: transform .3s var(--ease); }
  html.top-off .top { transform: translateY(-100%); }
  html.top-off .tabs-wrap { transform: translateY(calc(-1 * var(--top-h))); }
  html.top-off .tip { display: none; }

  .dock {
    transition: transform .3s var(--ease);
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border: 0;
    border-radius: 18px; background: var(--royal); color: #fff; text-align: left; box-shadow: none;
  }
  .dock__txt { display: flex; flex-direction: column; min-width: 0; }
  .dock__txt > span { font-size: 12px; color: rgba(255, 255, 255, .65); }
  .dock__txt b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .dock__txt small { font-size: 11.5px; color: rgba(255, 255, 255, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock__btn { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 46px; padding: 0 14px; border-radius: 12px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25); font-size: 14px; font-weight: 500; }
  .dock:not([data-state="fresh"]) .dock__btn { background: #fff; color: var(--navy); }
  .dock:not([data-state="fresh"]) .dock__btn svg { transform: rotate(-90deg); }
  .dock[data-state="empty"] .dock__txt b { font-size: 16px; font-weight: 500; opacity: .85; }
  .dock__btn svg { width: 16px; height: 16px; transform: rotate(180deg); transition: transform .35s var(--spring); }
  .sheet-open .dock__btn svg { transform: none; }
  .dock b.bump { animation: bump .5s var(--spring); }
  .dock:active { scale: .985; }
  /* while typing the keyboard is up: the sum bar steps aside instead of covering the field */
  html.kb-open:not(.sheet-open) .dock { transform: translateY(calc(100% + 24px + env(safe-area-inset-bottom))); }

  .foot__row { flex-direction: column; gap: 8px; }
  .foot__credit { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }

  .dlg { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .dlg[open] { animation: sheetIn .45s var(--spring); }
  .dlg.is-closing { animation: sheetOut .22s var(--ease) forwards; }
  .dlg__body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
@media (min-width: 600px) and (max-width: 899px) {
  .toggles { grid-template-columns: 1fr 1fr; }
  .result { left: 50%; right: auto; width: min(560px, 100vw); margin-left: max(-280px, -50vw); }
}
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }

@media (max-width: 360px) {
  .brand__a { display: none; }
  .top__tools { gap: 4px; }
  .tool { width: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  [data-enter] > * { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ---------- tab tooltips and the panel's "what is this" ---------- */
.tip { position: fixed; z-index: 90; width: max-content; max-width: min(320px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(19, 48, 27, .18); pointer-events: none; opacity: 0; transform: translateY(-4px); transition: opacity .16s var(--ease), transform .16s var(--ease); }
.tip[data-side="above"] { transform: translateY(4px); }
.tip.is-on { opacity: 1; transform: none; }
.tip b { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 500; }
.tip p { margin: 0; font-size: 13.5px; line-height: 1.45; color: #d4f0c4; }
.tip::before { content: ""; position: absolute; left: calc(var(--ax, 50%) - 6px); width: 12px; height: 12px; background: var(--ink); transform: rotate(45deg); border-radius: 2px; }
.tip[data-side="below"]::before { top: -5px; }
.tip[data-side="above"]::before { bottom: -5px; }
.panel__head h2 { display: inline; vertical-align: middle; }
.panel__info-btn { display: inline-grid; width: 30px; height: 30px; margin: -4px 0 -4px 4px; vertical-align: middle; }
.panel__info { margin: -10px 0 14px; }
.panel__info > p { padding: 0 14px; border-radius: 12px; background: var(--blue-50); font-size: 14px; line-height: 1.5; }
.panel__info.is-open > p { padding: 12px 14px; }
.tab { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }

.foot__legal { display: flex; flex-wrap: wrap; gap: 6px 22px; padding-bottom: 18px; font-size: 14px; }
.foot__legal a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.foot__legal a:hover { color: var(--blue-600); text-decoration-color: currentColor; }
