/*
 * Copyright (c) 2022-2026 Suhrab Bazarbayev, The Gosa. All rights reserved.
 * Valyutnik (Валютник) — website. Proprietary and confidential.
 *
 * Дизайн-система — как в приложении (docs/ios/06-design-system.md): те же токены цветов,
 * скругления и шрифты. Тёмная тема подменяет только значения токенов.
 */

:root {
  --brand: #0B7A3E; --brand-button: #0B7A3E; --brand-header: #06552B; --brand-header-field: #0A4424;
  --brand-container: #DCF2E3; --on-brand: #FFFFFF; --on-brand-muted: #B9DCC6; --on-brand-container: #0B5A30;
  --surface: #F4F7F5; --surface-card: #FFFFFF; --surface-variant: #EAF0EC; --outline: #DFE7E2;
  --text: #15201A; --text-2: #5E6E64; --hint: #8A988F;
  --positive: #17914A; --negative: #D3362D; --negative-container: #FCE4E2;
  --accent: #B86E00; --accent-container: #FFEFD2;
  --r-flag: 6px; --r-field: 14px; --r-card: 20px; --r-header: 28px;
  --pad: 16px; --tabbar-h: 84px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #3FBF73; --brand-button: #1E8A4C; --brand-header: #0D2E1C; --brand-header-field: #071C10;
    --brand-container: #1C3A28; --on-brand-muted: #9EC2AC; --on-brand-container: #A6E3BC;
    --surface: #0E1411; --surface-card: #18201B; --surface-variant: #232D27; --outline: #2A352E;
    --text: #EAF1EC; --text-2: #A3B3A9; --hint: #6F7F75;
    --positive: #57D488; --negative: #FF7A70; --negative-container: #3B2220;
    --accent: #FFB547; --accent-container: #3A2D12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #3FBF73; --brand-button: #1E8A4C; --brand-header: #0D2E1C; --brand-header-field: #071C10;
  --brand-container: #1C3A28; --on-brand-muted: #9EC2AC; --on-brand-container: #A6E3BC;
  --surface: #0E1411; --surface-card: #18201B; --surface-variant: #232D27; --outline: #2A352E;
  --text: #EAF1EC; --text-2: #A3B3A9; --hint: #6F7F75;
  --positive: #57D488; --negative: #FF7A70; --negative-container: #3B2220;
  --accent: #FFB547; --accent-container: #3A2D12;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--text);
  font: 16px/1.4 Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-weight: 500; margin: 0; }
h2 { font-size: 17px; }
.num { font-variant-numeric: tabular-nums; }
.hint { color: var(--text-2); font-size: 13px; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--pad); }
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; }
.ic.sm { width: 18px; height: 18px; }
.ic.xs { width: 14px; height: 14px; }
.flag { width: 44px; height: 32px; border-radius: var(--r-flag); border: 1px solid var(--outline); object-fit: cover; flex: none; background: var(--surface-variant); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.beta-bar { background: var(--accent-container); color: var(--accent); text-align: center; font-size: 13px; padding: 6px var(--pad); }

/* ---------- Шапка ---------- */
.hdr { background: var(--brand-header); color: var(--on-brand); border-radius: 0 0 var(--r-header) var(--r-header); padding-bottom: 20px; }
.topbar { display: flex; align-items: center; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-brand); font-weight: 500; font-size: 18px; margin-right: auto; }
.brand img { border-radius: 8px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn, .lang-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 10px;
  border: 0; border-radius: 999px; background: var(--brand-header-field); color: var(--on-brand); font-size: 14px; font-weight: 500; }
.icon-btn:hover, .lang-btn:hover { filter: brightness(1.15); }
.icon-btn.on { color: #FFB547; }
.tabs-top { display: none; }

.hero { display: flex; justify-content: center; padding-top: 4px; }
.country-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; color: var(--on-brand); padding: 8px 16px; border-radius: var(--r-card); }
.country-btn:hover { background: var(--brand-header-field); }
.flag-big { width: 96px; height: 64px; border-radius: 10px; object-fit: cover; border: 1px solid rgba(255,255,255,.25); background: var(--brand-header-field); }
.h-title { font-size: 24px; font-weight: 500; line-height: 1.25; }
.h-sub { color: var(--on-brand-muted); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 0; }
.h-sub b { color: var(--on-brand); font-weight: 500; }
.hero.compact { justify-content: flex-start; align-items: center; gap: 14px; text-align: left; }
.hero.compact .h-title { font-size: 20px; }
.hc-text { min-width: 0; flex: 1; }
.hc-actions { display: flex; gap: 6px; }
.icon-btn.on-brand.on svg { fill: #FF8A80; }

.search-box { margin-top: 14px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--brand-header-field); border-radius: var(--r-field); padding: 0 14px; height: 52px; color: var(--on-brand-muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--on-brand); font: inherit; font-size: 16px; outline: none; height: 100%; }
.search input::placeholder { color: var(--on-brand-muted); }

.tool-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-top: 4px; padding-bottom: 2px; }
.tool-tabs::-webkit-scrollbar { display: none; }
.pill { flex: none; display: inline-flex; align-items: center; height: 44px; padding: 0 18px; border-radius: 999px; border: 0;
  background: var(--brand-header-field); color: var(--on-brand-muted); font-size: 16px; font-weight: 500; white-space: nowrap; }
.pill.on { background: var(--brand-button); color: var(--on-brand); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--brand-container); color: var(--on-brand-container); font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip.on { background: var(--brand-button); color: var(--on-brand); }
.chip.static { cursor: default; }
.chip.on-brand { background: var(--brand-header-field); color: var(--on-brand); }

/* ---------- Основное ---------- */
.main { padding-top: 16px; }
.card { background: var(--surface-card); border: 1px solid var(--outline); border-radius: var(--r-card); }
.section { margin-top: 20px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .hint { margin: 4px 0 0; }
.cols { display: grid; gap: 16px; }
.col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.col > .section { margin-top: 8px; }

.rate-list { display: flex; flex-direction: column; gap: 10px; }
.rate-row { display: flex; align-items: center; gap: 14px; padding: 14px 12px 14px 16px; min-height: 76px;
  background: var(--surface-card); border: 1px solid var(--outline); border-radius: var(--r-card); color: var(--text); transition: background .15s; position: relative; }
a.rate-row:hover { background: var(--surface-variant); }
.rr-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rr-name b { font-size: 17px; font-weight: 500; }
.rr-name small { color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-val { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.rr-val b { font-size: 18px; font-weight: 500; white-space: nowrap; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; white-space: nowrap; color: var(--text-2); }
.trend.up { color: var(--positive); } .trend.down { color: var(--negative); }
.chev { color: var(--hint); width: 20px; height: 20px; }
.rate-list.compact .rate-row { min-height: 64px; padding: 10px 10px 10px 12px; }
.rate-row .fav-toggle, .rate-row .row-btn { border: 0; background: none; color: var(--hint); width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.rate-row .fav-toggle.on { color: var(--negative); }
.rate-row .row-btn:hover, .rate-row .fav-toggle:hover { background: var(--surface-variant); }
.rate-row.editing { cursor: default; }
.rate-row.dragging { opacity: .6; }

.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn, .btn-soft { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; font-size: 16px; font-weight: 500; }
.btn { background: var(--brand-button); color: var(--on-brand); }
.btn-soft { background: var(--brand-container); color: var(--on-brand-container); }
.btn:hover, .btn-soft:hover { filter: brightness(1.05); }
.btn.danger { background: var(--negative-container); color: var(--negative); }
.updated { color: var(--hint); font-size: 13px; margin: 14px 2px 0; }
.empty { text-align: center; color: var(--text-2); padding: 24px; }

.banks-card { display: flex; align-items: center; gap: 14px; padding: 0 18px; min-height: 64px; border-radius: var(--r-card);
  background: var(--brand-container); color: var(--on-brand-container); font-size: 18px; font-weight: 500; }
.banks-card span { flex: 1; }
.banks-card:hover { filter: brightness(1.03); }

.keyrate { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); }
.keyrate.is-empty { display: none; }
.kr-body { flex: 1; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
.kr-title { color: var(--text-2); font-size: 14px; }
.kr-rate { grid-row: span 2; font-size: 26px; font-weight: 500; color: var(--brand); }
.kr-since { font-size: 13px; color: var(--hint); }
.keyrate { flex-wrap: wrap; }
.kr-body { min-width: 220px; }
.kr-action { display: inline-flex; align-items: center; gap: 2px; color: var(--brand); font-size: 14px; font-weight: 500; white-space: nowrap; }

.plaque { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-card); background: var(--accent-container); color: var(--text); }
.plaque .ic { color: var(--accent); }
.plaque span { flex: 1; font-size: 14px; }
.plaque button { border: 0; background: none; color: var(--accent); font-weight: 500; font-size: 14px; padding: 8px; }

/* ---------- Поля сумм ---------- */
input.amount { width: 100%; height: 52px; border: 0; border-radius: var(--r-field); background: var(--surface-variant); color: var(--text);
  font: 500 22px/1 inherit; font-family: inherit; text-align: right; padding: 0 16px; font-variant-numeric: tabular-nums; outline: none; transition: background .15s, box-shadow .15s; }
input.amount:focus { background: var(--brand-container); box-shadow: 0 0 0 2px var(--brand) inset; }
input.amount::placeholder { color: var(--hint); }
.big-field { margin-top: 12px; height: 64px !important; font-size: 30px !important; background: var(--brand-header-field) !important; color: var(--on-brand) !important; }
.big-field::placeholder { color: var(--on-brand-muted) !important; }
.big-field:focus { box-shadow: 0 0 0 2px var(--brand) inset; }

.quick { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.quick h2 { margin-bottom: 2px; }
.qc-row { display: flex; align-items: center; gap: 10px; }
.qc-row input { flex: 1; min-width: 0; }
.qc-cur { display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px; border: 0; border-radius: var(--r-field); background: var(--brand-container); color: var(--on-brand-container); font-size: 16px; flex: none; min-width: 104px; }
.qc-cur .flag { width: 33px; height: 24px; }
.qc-swap { align-self: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--outline); background: var(--surface-card); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; margin: -4px 0; }
.qc-rate { margin: 2px 0 0; }

/* ---------- Конвертер ---------- */
.conv-list { display: grid; gap: 12px; }
.conv-item { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.ci-head { display: flex; align-items: center; gap: 14px; font-size: 17px; }
.ci-head b { font-weight: 500; flex: 1; min-width: 0; }
.ci-head .row-btn { border: 0; background: none; color: var(--hint); width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.ci-head .row-btn:hover { background: var(--surface-variant); color: var(--negative); }

/* ---------- Пара ---------- */
.today-card { display: grid; grid-template-columns: 1fr 1fr; }
.tc-cell { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tc-cell + .tc-cell { border-left: 1px solid var(--outline); }
.big { font-size: 28px; font-weight: 500; }
.chart-card, .history-card, .about { padding: 16px; }
.chart { height: 220px; margin-top: 8px; position: relative; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--text); color: var(--surface-card); border-radius: 10px; padding: 4px 10px; font-size: 13px; white-space: nowrap; pointer-events: none; }
.chart-legend { display: flex; justify-content: space-between; margin-top: 6px; }
.hist { display: grid; gap: 2px; margin-top: 8px; }
.hist-row { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--outline); font-size: 15px; }
.hist-row:last-child { border: 0; }
.about dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 12px 0 0; }
.about dt { color: var(--text-2); } .about dd { margin: 0; }

/* ---------- Калькулятор ---------- */
.calc-layout { display: grid; gap: 12px; max-width: 560px; margin: 0 auto; }
.calc-screen { padding: 14px 16px; display: flex; flex-direction: column; min-height: 230px; }
.calc-target { align-self: stretch; display: flex; align-items: center; justify-content: space-between; border: 0; background: var(--surface-variant); border-radius: var(--r-field); padding: 8px 12px; }
.ct-cur { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.ct-cur .flag { width: 33px; height: 24px; }
.calc-history { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; color: var(--hint); font-size: 15px; text-align: right; min-height: 48px; max-height: 120px; overflow-y: auto; margin-top: 8px; }
.calc-history button { border: 0; background: none; color: inherit; text-align: right; padding: 2px 0; font: inherit; }
.calc-expr { text-align: right; color: var(--text-2); font-size: 18px; min-height: 24px; word-break: break-all; }
.calc-main { text-align: right; font-size: 40px; font-weight: 500; line-height: 1.15; word-break: break-all; }
.calc-main.m { font-size: 32px; } .calc-main.s { font-size: 26px; }
.calc-main.err { color: var(--negative); font-size: 22px; }
.calc-conv { text-align: right; color: var(--brand); font-size: 22px; font-weight: 500; min-height: 28px; }
.calc-sum { text-align: right; min-height: 18px; }
/* Телефон: экран и клавиатура калькулятора помещаются над панелью вкладок без прокрутки, как в приложении */
@media (max-width: 959px) {
  .calc-screen { min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .calc-history { min-height: 0; max-height: clamp(0px, calc(100dvh - 680px), 120px); }
  .key { height: clamp(44px, 6.6dvh, 64px) !important; }
}
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.key { height: 64px; border: 0; border-radius: var(--r-card); font-size: 24px; font-weight: 500; display: flex; align-items: center; justify-content: center; user-select: none; -webkit-tap-highlight-color: transparent; transition: filter .1s, transform .05s; }
.key:active { transform: scale(.97); filter: brightness(.95); }
.k-num { background: var(--surface-variant); color: var(--text); }
.k-op { background: var(--brand-container); color: var(--on-brand-container); }
.k-clear { background: var(--negative-container); color: var(--negative); }
.k-eq { background: var(--brand-button); color: var(--on-brand); }

.tool { display: grid; gap: 12px; max-width: 760px; margin: 0 auto; }
.tool .field { display: flex; flex-direction: column; gap: 6px; }
.tool .field > span { font-size: 14px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.tool .field .unit { position: relative; }
.tool .field .unit input { padding-right: 60px; }
.tool .field .unit em { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--text-2); font-size: 15px; pointer-events: none; }
.tool .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tool select { width: 100%; height: 52px; border: 0; border-radius: var(--r-field); background: var(--surface-variant); color: var(--text); font: 500 18px inherit; font-family: inherit; padding: 0 14px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices .chip { height: 40px; }
.choices.secondary .chip { background: var(--surface-variant); color: var(--text-2); }
.choices.secondary .chip.on { background: var(--brand-container); color: var(--on-brand-container); }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.switch-row > span { flex: 1; display: flex; flex-direction: column; }
.switch-row small { color: var(--text-2); font-size: 13px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-variant); border: 2px solid var(--outline); transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; left: 4px; top: 4px; border-radius: 50%; background: var(--hint); transition: .2s; }
.switch input:checked + i { background: var(--brand-button); border-color: var(--brand-button); }
.switch input:checked + i::after { left: 24px; background: #fff; }
.result { padding: 16px; background: var(--brand-container); border: 0; color: var(--on-brand-container); }
.result .r-label { font-size: 14px; opacity: .85; }
.result .r-value { font-size: 30px; font-weight: 500; margin: 2px 0 6px; word-break: break-word; }
.result .r-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid rgba(127,127,127,.2); font-size: 15px; }
.result .r-row b { font-weight: 500; text-align: right; }
.note { color: var(--text-2); font-size: 13px; margin: 0 4px; }
.small-hint { color: var(--text-2); font-size: 13px; margin: -4px 4px 0; }
.box { display: grid; gap: 12px; padding-left: 12px; border-left: 3px solid var(--brand-container); }
.table-wrap { overflow-x: auto; border-radius: var(--r-card); border: 1px solid var(--outline); background: var(--surface-card); max-height: 520px; overflow-y: auto; }
.sched { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.sched th { position: sticky; top: 0; background: var(--surface-card); color: var(--text-2); font-weight: 500; text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--outline); white-space: nowrap; }
.sched td { text-align: right; padding: 8px 12px; white-space: nowrap; }
.sched th:first-child, .sched td:first-child { text-align: left; }
.sched tr:nth-child(even) td { background: var(--surface-variant); }
.sched td.extra { color: var(--brand); font-weight: 500; }

/* ---------- Банки ---------- */
.banks-top { padding: 14px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.banks-top:empty { display: none; }
.bt-cell small { display: block; color: var(--text-2); font-size: 13px; }
.bt-cell b { font-size: 22px; font-weight: 500; }
.bt-cell span { display: block; font-size: 13px; color: var(--brand); }
.bt-market { grid-column: 1 / -1; font-size: 13px; color: var(--text-2); }
.sort-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 10px; }
.bank-list { display: grid; gap: 10px; }
.bank-row { display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 12px; padding: 12px 14px; }
.bank-logo { position: relative; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-container); color: var(--on-brand-container); border: 1px solid var(--outline); display: grid; place-items: center; overflow: hidden; font-size: 18px; }
.bank-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.br-name { min-width: 0; display: flex; flex-direction: column; }
.br-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-rate { display: flex; flex-direction: column; align-items: flex-end; min-width: 76px; }
.br-rate b { font-size: 17px; font-weight: 500; }
.br-rate b.best { color: var(--positive); }
.br-rate .diff { font-size: 12px; color: var(--text-2); }
.disclaimer { margin: 16px 4px; }

/* ---------- Настройки ---------- */
.settings { display: grid; gap: 12px; max-width: 760px; margin: 0 auto; }
.set-group { overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; background: none; text-align: left; color: var(--text); }
.set-row + .set-row { border-top: 1px solid var(--outline); }
.set-row:hover { background: var(--surface-variant); }
.set-ic { color: var(--brand); display: inline-flex; }
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-text b { font-weight: 500; }
.set-text small { color: var(--text-2); font-size: 14px; }

/* ---------- Окна ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 88vh; border-radius: var(--r-header) var(--r-header) 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.sheet-head h3 { flex: 1; font-size: 18px; }
.sheet-head .x { border: 0; background: var(--surface-variant); width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.sheet-body { overflow-y: auto; padding: 4px 16px 16px; }
.sheet .search { background: var(--surface-variant); color: var(--text-2); margin: 0 16px 8px; }
.sheet .search input { color: var(--text); }
.sheet .search input::placeholder { color: var(--hint); }
.pick-head { font-size: 13px; color: var(--text-2); margin: 12px 4px 6px; font-weight: 500; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 14px; background: none; text-align: left; color: var(--text); }
.pick-row:hover, .pick-row.sel { background: var(--surface-variant); }
.pick-row .flag { width: 38px; height: 28px; }
.pick-row span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-row small { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-row .ic { color: var(--brand); }
.dialog { padding: 0 16px 16px; display: grid; gap: 12px; }
.dialog p { margin: 0; color: var(--text-2); font-size: 14px; }
.dialog .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.dialog .err { color: var(--negative); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px); transform: translateX(-50%); background: var(--text); color: var(--surface-card); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
.toast button { border: 0; background: none; color: var(--brand-container); font-weight: 500; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }

/* ---------- Нижняя панель (телефон) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--brand-header); border-radius: var(--r-header) var(--r-header) 0 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.tabbar .track { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--brand-header-field); border-radius: 999px; padding: 4px; max-width: 560px; margin: 0 auto; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 56px; border-radius: 999px; color: var(--on-brand-muted); font-size: 12px; font-weight: 500; min-width: 0; }
.tabbar a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; padding: 0 4px; }
.tabbar a.on { background: #fff; color: var(--brand-header); }
:root[data-theme="dark"] .tabbar a.on { background: #EAF1EC; }

/* ---------- Подвал ---------- */
.footer { margin-top: 28px; padding-bottom: 24px; color: var(--text-2); font-size: 14px; }
.app-promo { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px; }
.app-promo img { border-radius: 14px; }
.app-promo div:nth-child(2) { flex: 1; min-width: 200px; }
.app-promo b { color: var(--text); font-weight: 500; font-size: 17px; }
.app-promo p { margin: 2px 0 0; }
.stores { display: flex; gap: 8px; flex-wrap: wrap; }
.stores img { height: 44px; width: auto; border-radius: 8px; }
.foot-links { margin: 16px 4px 4px; line-height: 2; }
.foot-links a[aria-current] { color: var(--text); font-weight: 500; }
.copy { margin: 4px; font-size: 12px; color: var(--hint); }
.seo { padding: 16px; margin-top: 20px; color: var(--text-2); font-size: 15px; }
.seo h2 { color: var(--text); margin-bottom: 6px; }
.seo p { margin: 6px 0 0; white-space: pre-line; }
.empty-state { padding: 24px; text-align: center; display: grid; gap: 16px; justify-items: center; }

/* ---------- Планшет и ПК ---------- */
@media (min-width: 700px) {
  .conv-list { grid-template-columns: 1fr 1fr; }
  .tool .two { gap: 16px; }
}
@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .toast { bottom: 24px; }
  .tabs-top { display: flex; gap: 4px; background: var(--brand-header-field); border-radius: 999px; padding: 4px; }
  .tabs-top a { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px; color: var(--on-brand-muted); font-weight: 500; font-size: 15px; }
  .tabs-top a:hover { color: var(--on-brand); }
  .tabs-top a.on { background: #fff; color: var(--brand-header); }
  .topbar { height: 72px; }
  .hdr { padding-bottom: 28px; }
  .cols { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 24px; }
  .side { position: sticky; top: 16px; }
  .main { padding-top: 24px; }
  .calc-layout { max-width: 980px; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .calc-screen { min-height: 100%; }
  .key { height: 72px; }
  .sheet-bg { align-items: center; }
  .sheet { border-radius: var(--r-card); max-height: 80vh; }
  .rate-list.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
  .conv-list { grid-template-columns: repeat(3, 1fr); }
  .is-wide .tool { max-width: 980px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .is-wide .tool > .span { grid-column: 1 / -1; }
}
@media (max-width: 380px) {
  :root { --pad: 12px; }
  .rr-val b { font-size: 16px; }
  .key { height: 58px; }
  .bank-row { grid-template-columns: 32px 1fr auto auto; gap: 8px; padding: 10px; }
  .bank-logo { width: 32px; height: 32px; }
  .br-rate { min-width: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Заголовок страницы калькулятора (виден людям и поисковикам) */
.tool-h1 { font-size: 20px; font-weight: 600; margin: 4px 0 14px; line-height: 1.3; }

/* ---------- Блоки для поисковиков (видны и людям) ---------- */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 0; margin: 0 0 16px; font-size: 13px; color: var(--hint); }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--hint); }
.crumbs a { color: var(--text-2); }
.faq { margin-top: 16px; padding: 16px 18px; }
.faq h2 { font-size: 18px; margin: 0 0 8px; }
.faq details { border-top: 1px solid var(--outline); padding: 12px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 8px 0 0; color: var(--text-2); line-height: 1.5; }
.conv-tables { margin-top: 16px; }
.conv-tables .card { padding: 14px 16px; }
.conv-tables h2 { font-size: 17px; margin: 0 0 6px; }
.conv-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.conv-table td { padding: 7px 0; border-top: 1px solid var(--outline); }
.conv-table tr:first-child td { border-top: 0; }
.conv-table td + td { text-align: right; font-weight: 600; }
.site-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-bottom: 20px; }
.site-links h2 { font-size: 15px; margin: 0 0 8px; color: var(--text); }
.site-links ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.site-links a { color: var(--text-2); }
.site-links a:hover, .crumbs a:hover { color: var(--brand); }
@media (max-width: 699px) { .site-links { grid-template-columns: 1fr; } }
@media (min-width: 700px) { .cols.conv-tables { grid-template-columns: 1fr 1fr; } }

/* ---------- Страница «Скачать» ---------- */
.page-download .hdr { padding-bottom: 8px; }
.dl-hero { display: grid; gap: 24px; align-items: center; padding: 24px 20px 0; margin-top: 4px; border-radius: var(--r-card); overflow: hidden;
  background: radial-gradient(120% 90% at 100% 0%, #1E8A4C 0%, transparent 60%), linear-gradient(160deg, #0D2E1C 0%, #06552B 100%); color: #fff; }
.dl-icon { border-radius: 22px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.dl-hero h1 { font-size: 28px; line-height: 1.2; margin: 16px 0 10px; font-weight: 700; }
.dl-lead { font-size: 17px; line-height: 1.5; margin: 0 0 18px; color: #CFE6D8; }
.dl-for-you { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; color: #A6E3BC; }
.dl-for-you[hidden] { display: none; }
.dl-for-you .ic { width: 18px; height: 18px; fill: currentColor; }
.dl-stores { display: flex; flex-wrap: wrap; gap: 10px; }
.dl-stores .store { display: inline-flex; border-radius: 12px; transition: transform .15s, box-shadow .15s; }
.dl-stores .store:hover { transform: translateY(-2px); }
.dl-stores img { height: 52px; width: auto; border-radius: 10px; display: block; }
.dl-stores .store.mine { box-shadow: 0 0 0 3px #3FBF73, 0 6px 18px rgba(63,191,115,.35); }
.dl-perks { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 14px; color: #E3F1E8; }
.dl-perks li { display: flex; gap: 6px; align-items: flex-start; line-height: 1.35; }
.dl-perks .ic { flex: none; width: 18px; height: 18px; fill: #3FBF73; margin-top: 1px; }
.dl-hero-phones { position: relative; height: 380px; display: flex; justify-content: center; align-items: flex-end; }
.dl-hero-phones .phone { position: absolute; bottom: -40px; width: 190px; height: auto; border-radius: 26px; border: 6px solid #0A1A11;
  box-shadow: 0 20px 50px rgba(0,0,0,.45); background: #0A1A11; }
.dl-hero-phones .front { transform: translateX(46px) rotate(4deg); z-index: 2; }
.dl-hero-phones .back { transform: translateX(-70px) rotate(-6deg); opacity: .9; }
.dl-h2 { font-size: 24px; margin: 36px 0 8px; text-align: center; }
.dl-features { display: grid; gap: 8px; }
.dl-feature { display: grid; gap: 16px; align-items: center; padding: 20px 0; }
.dl-feature + .dl-feature { border-top: 1px solid var(--outline); }
.dl-feature h3 { font-size: 21px; margin: 0 0 8px; line-height: 1.25; }
.dl-feature p { margin: 0; color: var(--text-2); font-size: 16px; line-height: 1.6; }
.dl-shot { margin: 0; display: flex; justify-content: center; }
.dl-shot img { width: 240px; max-width: 70vw; height: auto; border-radius: 28px; border: 6px solid #0A1A11; background: #0A1A11;
  box-shadow: 0 18px 40px rgba(6,40,22,.25); }
.dl-cta { margin-top: 28px; padding: 28px 20px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.dl-cta img { border-radius: 16px; }
.dl-cta h2 { margin: 6px 0 0; font-size: 22px; }
.dl-cta p { margin: 0 0 10px; font-size: 15px; }
.dl-cta .dl-stores { justify-content: center; }
.dl-share { margin-top: 16px; padding: 20px; }
.dl-share h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; margin: 0 0 6px; }
.dl-share h2 .ic { width: 22px; height: 22px; fill: var(--brand); }
.dl-share p { margin: 0 0 14px; color: var(--text-2); line-height: 1.5; }
.dl-link { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dl-link code { flex: 1 1 200px; font: 600 18px/1 system-ui, sans-serif; padding: 15px 16px; border-radius: var(--r-field); background: var(--surface-variant); color: var(--text); user-select: all; }
.dl-link .ic { width: 20px; height: 20px; fill: currentColor; }
@media (max-width: 420px) {
  .dl-hero { padding: 20px 16px 0; }
  .dl-hero h1 { font-size: 24px; }
  .dl-stores img { height: 46px; }
  .dl-perks { grid-template-columns: 1fr; }
  .dl-link .btn, .dl-link .btn-soft { flex: 1; }
}
@media (min-width: 860px) {
  .dl-hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); padding: 48px 48px 0; gap: 32px; }
  .dl-hero-text { padding-bottom: 48px; }
  .dl-hero h1 { font-size: 40px; }
  .dl-hero-phones { height: 520px; }
  .dl-hero-phones .phone { width: 250px; bottom: -60px; }
  .dl-hero-phones .front { transform: translateX(70px) rotate(4deg); }
  .dl-hero-phones .back { transform: translateX(-90px) rotate(-6deg); }
  .dl-h2 { font-size: 30px; margin-top: 56px; }
  .dl-feature { grid-template-columns: 1fr 1fr; gap: 56px; padding: 36px 24px; }
  .dl-feature.rev .dl-feature-text { order: 2; }
  .dl-feature h3 { font-size: 28px; }
  .dl-feature p { font-size: 18px; }
  .dl-shot img { width: 280px; }
  .dl-cta { padding: 40px; }
}
