[hidden] { display: none !important; }
/* Brand: deep teal on white, spaced caps name, roof-line divider */
:root {
  --bg: #f2f7f7; --surface: #ffffff; --line: #d3e2e3; --fg: #15343c; --muted: #587277;
  --accent: #00767f; --accent-ink: #ffffff; --accent-soft: #dff0f1;
  --ok: #1f7a3f; --ok-soft: #e3f3e8; --warn: #a35a00; --warn-soft: #fbefdc; --bad: #b3261e; --bad-soft: #fbe5e3;
  --font-body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Montserrat", "Rubik", system-ui, sans-serif;
  --font-num: "JetBrains Mono", "Rubik", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1719; --surface: #142225; --line: #26393d; --fg: #e3eef0; --muted: #8fa8ac;
    --accent: #4fbcc4; --accent-ink: #062327; --accent-soft: #123338;
    --ok: #5fcf86; --ok-soft: #173023; --warn: #f0a94a; --warn-soft: #34270f; --bad: #f2867e; --bad-soft: #3a1b19;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .bar i { transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h1 { font-size: 2rem; margin: 0; font-weight: 700; }
h2 { font-size: 1.35rem; margin: 0; font-weight: 600; }
h3 { font-size: 1.05rem; margin: 0; font-weight: 600; }
p { margin: 0; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding-block: 16px 8px; }
.id { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.mono { width: 54px; height: 42px; flex: none; background: var(--accent); -webkit-mask: url(logo.png) center/contain no-repeat; mask: url(logo.png) center/contain no-repeat; }
.id-text { display: flex; flex-direction: column; gap: 3px; padding-inline-start: 12px; border-inline-start: 1px solid var(--accent); }
.bname { font: 600 1.05rem/1 var(--font-brand); letter-spacing: .16em; color: var(--accent); white-space: nowrap; direction: ltr; }
.tag { font-size: .8rem; font-weight: 500; color: var(--accent); }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
nav a { color: var(--fg); text-decoration: none; font-weight: 500; font-size: .95rem; padding-block: 6px; }
nav a:hover, nav a[aria-current] { color: var(--accent); }
nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent); }
nav a.lang { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; box-shadow: none; }
.roof { display: block; width: 100%; height: 22px; color: var(--accent); }
[dir=rtl] .roof { transform: scaleX(-1); }

/* buttons */
.btn { display: inline-block; font: 600 1rem var(--font-body); text-decoration: none; text-align: center; border-radius: 8px; padding: 12px 18px; border: 1px solid transparent; cursor: pointer; }
.btn.main { background: var(--accent); color: var(--accent-ink); }
.btn.alt { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: progress; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* content pages */
main { padding-block: 20px 40px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: center; }
.hero .lead { font-size: 1.15rem; color: var(--muted); margin-block: 12px 20px; }
.hero img { border-radius: 12px; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 28%; }
@media (max-width: 760px) { .hero { grid-template-columns: minmax(0, 1fr); gap: 20px; } .hero img { order: -1; max-width: 170px; } h1 { font-size: 1.65rem; } }
.sec { margin-top: 36px; display: flex; flex-direction: column; gap: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.card p { color: var(--muted); font-size: .95rem; }
.card .btn { margin-top: auto; }
.card.free { border-color: var(--accent); }
.band { background: var(--accent-soft); border-radius: 10px; padding: 16px; font-weight: 500; }
.prose { max-width: 760px; display: flex; flex-direction: column; gap: 12px; }
.prose h2 { margin-top: 12px; font-size: 1.15rem; }
.prose ul { margin: 0; padding-inline-start: 20px; }
.draft { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-weight: 500; }
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.contact-list a { font-weight: 500; }

/* footer */
footer { border-top: 1px solid var(--line); padding-block: 18px 28px; font-size: .85rem; color: var(--muted); }
footer .wrap { display: flex; flex-direction: column; gap: 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.foot-links a { color: var(--muted); }

/* calculator */
.calc-head { margin-bottom: 18px; display: flex; flex-direction: column; gap: 6px; }
.calc-head p { color: var(--muted); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 880px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
section.block { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.block h2 { font-size: 1.1rem; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; justify-content: center; font: 600 .8rem var(--font-num); color: var(--accent-ink); background: var(--accent); border-radius: 4px; min-width: 22px; padding: 1px 6px; margin-inline-end: 8px; vertical-align: 2px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); min-width: 0; }
/* 16px keeps iPhone from zooming into the field */
input[type=text], input[type=tel], input[type=email], select { font: 500 16px var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; width: 100%; min-height: 44px; }
input.n { font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; }
[dir=rtl] input.n { text-align: right; }
input[type=tel], input[type=email] { direction: ltr; }
[dir=rtl] input[type=tel], [dir=rtl] input[type=email] { text-align: right; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.row { display: grid; gap: 10px; }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 460px) { .row-3 { grid-template-columns: minmax(0, 1fr); } }
.person, .loan-wrap { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.loan-wrap.is-off { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.item-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 500; }
.avg { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 6px; border-top: 1px solid var(--line); font-size: .92rem; color: var(--muted); }
.add { font: 500 .92rem var(--font-body); background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.add:hover { border-color: var(--accent); }
.del { font: 500 .85rem var(--font-body); background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; min-height: 34px; padding: 4px 10px; cursor: pointer; }
.del:hover { color: var(--bad); border-color: var(--bad); }
.ghost { font: 500 .92rem var(--font-body); background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.hint { font-size: .85rem; color: var(--muted); }
.calc-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: .95rem; }
.calc-line > span:first-child { color: var(--muted); }
.money, .calc-line b, .avg b { font-family: var(--font-num); font-weight: 600; white-space: nowrap; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.avg b { color: var(--fg); font-size: 1.05rem; }
.calc-line.big b { font-size: 1.2rem; color: var(--accent); }
.check { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; font-size: .92rem; color: var(--fg); cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seg label { flex-direction: row; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--fg); font-size: .92rem; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg input { width: 18px; height: 18px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }
.seg small { display: block; color: var(--muted); }
@media (max-width: 460px) { .seg { grid-template-columns: minmax(0, 1fr); } }
.loan-est { font-size: .85rem; color: var(--muted); }
.loan-est .money { color: var(--fg); }

/* results */
aside { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 880px) { aside { position: static; } }
.res { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.res h3 { font-size: .85rem; color: var(--muted); font-weight: 600; }
.verdict { border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 6px; border: 1px solid transparent; scroll-margin-top: 12px; }
.verdict .pct { font: 600 2.4rem/1 var(--font-num); direction: ltr; unicode-bidi: isolate; text-align: start; }
.verdict .lbl { font-size: .88rem; }
.verdict .msg { font-weight: 500; }
.v-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.v-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.v-bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.v-none { background: var(--surface); color: var(--muted); border-color: var(--line); }
.bar { height: 8px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; }
.bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: currentColor; border-radius: 4px; transition: width .2s; }
.bar span { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--fg); opacity: .5; }
.neg { color: var(--bad) !important; }
.lead-form { display: flex; flex-direction: column; gap: 10px; }
.lead-form .trap { position: absolute; inset-inline-start: -9999px; height: 1px; overflow: hidden; }
.form-msg { font-size: .88rem; color: var(--muted); }
.form-msg.err { color: var(--bad); }
.mini { display: none; }
@media (max-width: 880px) {
  .mini { position: fixed; inset-inline: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 500; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .mini b { font: 600 1.1rem var(--font-num); direction: ltr; unicode-bidi: isolate; }
  body.has-mini footer { padding-bottom: 76px; }
}

/* price variants */
.var-wrap { overflow-x: auto; }
.var { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.var th, .var td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: end; white-space: nowrap; }
.var th:first-child, .var td:first-child { position: sticky; inset-inline-start: 0; background: var(--surface); text-align: start; color: var(--muted); font-weight: 400; white-space: normal; padding-inline-start: 0; min-width: 104px; }
.var th { font-weight: 600; color: var(--fg); }
.var td { font-family: var(--font-num); font-weight: 500; }
.var td:first-child { font-family: var(--font-body); }
.var tr.key td { font-weight: 600; }
.var td .money { font-weight: inherit; }
.chip { display: inline-block; border-radius: 4px; padding: 2px 6px; font: 500 .78rem var(--font-body); white-space: normal; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.none { color: var(--muted); }

/* off-screen PDF sheet: always light, fixed A4 width */
#sheet { position: fixed; left: -10000px; top: 0; width: 794px; background: #ffffff; color: #15343c; font-family: var(--font-body); font-size: 13px; line-height: 1.45; padding: 36px 44px; }
#sheet .s-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 14px; border-bottom: 1.5px solid #00767f; }
#sheet .s-id { display: flex; align-items: center; gap: 14px; }
#sheet .s-id img { width: 60px; height: 47px; }
#sheet .s-name { font: 600 18px/1 var(--font-brand); letter-spacing: .2em; color: #00767f; direction: ltr; }
#sheet .s-tag { color: #00767f; font-size: 12px; margin-top: 6px; }
#sheet .s-contacts { font-size: 12px; line-height: 1.6; direction: ltr; }
#sheet h1 { font-size: 20px; margin: 18px 0 2px; color: #15343c; }
#sheet .s-date { color: #587277; font-size: 12px; margin-bottom: 14px; }
#sheet h2 { font-size: 14px; color: #00767f; margin: 16px 0 6px; font-weight: 600; }
#sheet table { width: 100%; border-collapse: collapse; }
#sheet td { padding: 3px 0; border-bottom: 1px solid #e3ecec; vertical-align: top; text-align: start; }
#sheet td.v { text-align: right; font-family: var(--font-num); font-weight: 600; white-space: nowrap; padding-inline-start: 16px; width: 1%; }
#sheet[dir=rtl] td.v { text-align: left; }
#sheet .s-var td.v { width: auto; }
#sheet tr.tot td { font-weight: 600; border-bottom: 1.5px solid #15343c; }
#sheet .s-verdict { margin-top: 18px; border-radius: 8px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
#sheet .s-verdict b { font: 600 28px/1 var(--font-num); direction: ltr; }
#sheet .s-var tr:first-child td { font-weight: 600; color: #00767f; }
#sheet td.s-res { text-align: right; font-weight: 600; padding-inline-start: 16px; font-size: 12px; }
#sheet[dir=rtl] td.s-res { text-align: left; }
#sheet .s-two { display: flex; gap: 28px; }
#sheet .s-two > div { flex: 1; min-width: 0; }
#sheet .s-foot { margin-top: 22px; padding-top: 10px; border-top: 1px solid #d3e2e3; font-size: 11px; color: #587277; }
