@font-face { font-family: Onest; font-weight: 400; font-display: swap; src: url(fonts/onest-cyrillic-400.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 400; font-display: swap; src: url(fonts/onest-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20BD, U+2212; }
@font-face { font-family: Onest; font-weight: 500; font-display: swap; src: url(fonts/onest-cyrillic-500.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 500; font-display: swap; src: url(fonts/onest-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20BD, U+2212; }
@font-face { font-family: Onest; font-weight: 600; font-display: swap; src: url(fonts/onest-cyrillic-600.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 600; font-display: swap; src: url(fonts/onest-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20BD, U+2212; }
@font-face { font-family: Onest; font-weight: 700; font-display: swap; src: url(fonts/onest-cyrillic-700.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 700; font-display: swap; src: url(fonts/onest-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20BD, U+2212; }

:root {
  --green: #2454E6;
  --green-2: #1F8A5B;
  --green-soft: #EEF2FE;
  --gold: #2454E6;
  --gold-soft: #EEF2FE;
  --gold-text: #1B3FB0;
  --bg: #F2F3F6;
  --surface: #FFFFFF;
  --ink: #12141A;
  --muted: #6A6E78;
  --line: #E6E7EB;
  --danger: #C2271C;
  --danger-soft: #FEF2F1;
  --radius: 18px;
  --radius-sm: 12px;
  --focus: 0 0 0 3px #fff, 0 0 0 5px #2454E6;
}*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: 40vh; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 Onest, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.wrap {
  max-width: 560px; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

/* Шапка */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 2px 18px; }
.brand-mark { width: 44px; height: 44px; flex: none; }
.brand-name { font-size: 21px; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; font-weight: 600; }
.brand-name b { font-weight: 700; }
.brand-name .dash { color: var(--gold); }
.brand-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* Ввод */
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(20,22,27,.04); border-radius: var(--radius); padding: 18px 16px; }
.field { margin-bottom: 16px; }
label, .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.input-wrap { position: relative; flex: 1; min-width: 0; }
input[type=text] {
  width: 100%; height: 56px; padding: 0 40px 0 14px;
  font-size: 22px; font-weight: 600; letter-spacing: .01em;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  outline: none; -webkit-appearance: none; appearance: none;
}
input[type=text]::placeholder { color: #A8ABB2; font-weight: 500; font-size: 18px; }
input[type=text]:focus { border-color: var(--green); background: #fff; }
input[aria-invalid=true] { border-color: var(--danger); background: var(--danger-soft); }
.suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; font-size: 18px; pointer-events: none; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { padding-right: 14px; }
.msg { margin: 6px 2px 0; font-size: 14px; color: var(--danger); font-weight: 500; }
.msg:empty, .hint:empty { display: none; }
.msg.ok { color: var(--green-2); }
.hint { margin: 6px 2px 0; font-size: 13px; color: var(--muted); }

.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg button {
  flex: 1; min-height: 46px; border: 0; border-radius: 9px; background: transparent;
  font-weight: 600; font-size: 15px; color: var(--muted); padding: 0 10px;
}
.seg button[aria-checked=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,22,27,.12), 0 0 0 1px rgba(20,22,27,.04); }
.seg-unit { flex: none; width: 112px; }

.rate-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 2px 0 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--line); color: var(--ink); font-size: 15px;
}
.rate-line:empty { display: none; }
.rate-line strong { font-size: 17px; }
.rate-why { color: var(--muted); font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-text); border: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 0 18px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 16px; border: 1.5px solid transparent;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:disabled { background: #D5D7DC; color: #fff; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--green); }
.btn-small { min-height: 44px; font-size: 15px; }

.settings { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.settings summary {
  min-height: 48px; display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; color: var(--muted); cursor: pointer; list-style: none; border-radius: 8px;
}
.settings summary::-webkit-details-marker { display: none; }
.settings summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); margin-right: 6px; }
.settings[open] summary::after { transform: rotate(-135deg) translateX(-3px); }
.settings-body { padding: 4px 0 6px; }
.settings-body .seg { margin-bottom: 12px; }
#custom-field { margin-bottom: 8px; }
#reset-tariff { margin-top: 12px; }

/* Результаты */
.results { margin-top: 18px; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.paid { text-align: center; padding: 28px 18px; border-radius: var(--radius); background: var(--green-soft); color: var(--green); }
.paid strong { display: block; font-size: 18px; margin-bottom: 4px; }
.note { font-size: 14px; color: var(--muted); padding: 0 2px 12px; margin: 0; }
.note b { color: var(--ink); font-weight: 600; }

.cards { display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-top { padding: 14px 16px 4px; }
.first-box {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px;
  margin: 8px 0 6px; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); border: 0;
}
.first-label { font-size: 14px; font-weight: 600; color: var(--gold-text); }
.seg-3 button { padding: 0 6px; font-size: 14px; }
.sub-label { margin-top: 12px; }
#down-block .seg { margin-bottom: 0; }
#go-premium { margin-top: 10px; }
.partial { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); border: 0; font-size: 14px; }
.card.off .why b { color: var(--ink); }
.sched tr.down-row td { background: var(--gold-soft); font-weight: 700; }
#confirm-text { margin: 8px 0 0; font-size: 15px; }
.first-sum { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.facts { padding: 6px 16px 10px; font-size: 14px; color: var(--ink); }
.facts p { margin: 0; padding: 5px 0; border-top: 1px solid var(--line); }
.facts p:first-child { border-top: 0; }
.facts .fl { color: var(--muted); }
.card-toggle { color: var(--ink) !important;
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px;
  padding: 0 16px; background: none; border: 0; border-top: 1px solid var(--line);
  font-weight: 600; font-size: 15px; color: var(--green); text-align: left;
}
.card-toggle::after {
  content: ""; width: 9px; height: 9px; margin-right: 4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px);
}
.card-toggle[aria-expanded=true]::after { transform: rotate(-135deg) translateX(-3px); }
.sched td small { color: var(--muted); font-weight: 500; }
.term { display: block; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.pay { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; margin-top: 2px; }
.pay-sum { font-size: 28px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); line-height: 1.2; }
.pay-per { font-size: 14px; color: var(--muted); }
.markup { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }
.markup b { color: var(--ink); font-weight: 600; }
.last-note { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--ink); background: var(--gold-soft); padding: 2px 8px; border-radius: 6px; }
.card.off { background: transparent; border-style: dashed; padding: 14px 16px; }
.card.off .why { font-size: 14px; color: var(--muted); margin-top: 2px; }

.details { border-top: 1px solid var(--line); padding: 12px 16px 16px; }
.kv { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.kv .strong { color: var(--ink); font-weight: 700; }
.sched-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 6px; }
.sched { width: 100%; border-collapse: collapse; font-size: 14px; }
.sched th, .sched td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.sched th { font-weight: 600; color: var(--muted); font-size: 13px; }
.sched td:last-child, .sched th:last-child { text-align: right; }
.sched tr.diff td { font-weight: 700; }
.sched tfoot td { font-weight: 700; border-bottom: 0; }
.details .btn { margin-top: 14px; }

.compare { display: none; }

.bottom { margin-top: 20px; }
.foot { font-size: 12px; color: var(--muted); text-align: center; margin: 14px 0 0; }

/* Окно с текстом */
dialog {
  border: 0; padding: 0; background: transparent; width: 100%; max-width: 560px;
  margin: auto auto 0; max-height: 100dvh;
}
dialog::backdrop { background: rgba(10, 12, 16, .4); }
.sheet {
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.sheet textarea {
  width: 100%; margin-top: 10px; padding: 12px; font-size: 14px; line-height: 1.45;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
  resize: vertical; max-height: 50dvh;
}
.sheet-actions { display: grid; gap: 8px; margin-top: 12px; }

/* Фокус */
button:focus-visible, summary:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus); }
input[type=text]:focus-visible { box-shadow: 0 0 0 3px rgba(36, 84, 230, .18); }

/* Компьютер: две колонки и таблица сравнения */
@media (min-width: 960px) {
  .wrap { max-width: 1120px; padding-top: 28px; }
  .layout { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
  .inputs { position: sticky; top: 20px; }
  .results { margin-top: 0; }
  .compare { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 10px; margin-bottom: 16px; }
  .compare table { width: 100%; border-collapse: collapse; font-size: 14px; }
  .compare th, .compare td { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
  .compare th:first-child, .compare td:first-child { text-align: left; }
  .compare th { color: var(--muted); font-weight: 600; font-size: 13px; }
  .compare tr:last-child td { border-bottom: 0; }
  .compare td.big { font-weight: 700; font-size: 15px; }
  .cards { grid-template-columns: 1fr 1fr; align-items: start; }
  .bottom { max-width: 380px; }
  dialog { margin: auto; }
  .sheet { border-radius: 20px; }
}

@media (max-width: 359px) {
  .pay-sum { font-size: 24px; }
  input[type=text] { font-size: 20px; }
  .seg-unit { width: 96px; }
  .brand-name { font-size: 18px; }
}

@media (prefers-reduced-motion: no-preference) {
  .seg button, .btn, input[type=text] { transition: background-color .15s, border-color .15s, color .15s; }
}

/* Отправка графика */
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.share-row .btn { margin-top: 0; }
.btn-wa { background: #1DA851; color: #fff; }
.btn-wa svg { stroke: #fff; }
.btn-ghost { color: var(--ink); }
/* ===== Мобильная версия 2 ===== */
.brand {
  background: #12141A; color: #fff; border-radius: 22px; padding: 18px 18px 18px;
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.brand::after { content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(36,84,230,.55), rgba(36,84,230,0) 70%); }
.brand > * { position: relative; z-index: 1; }
.brand-name { color: #fff; font-size: 22px; }
.brand-sub { color: rgba(255,255,255,.62); }
.panel { border: 0; box-shadow: 0 1px 2px rgba(18,20,26,.05), 0 8px 24px rgba(18,20,26,.05); border-radius: 22px; }
input[type=text] { background: #F5F6F8; border-color: transparent; border-radius: 14px; height: 60px; font-size: 26px; font-weight: 700; }
input[type=text]:focus { border-color: var(--green); background: #fff; }
.seg { background: #F0F1F4; border: 0; border-radius: 14px; padding: 4px; }
.seg button { border-radius: 11px; }
.seg button[aria-checked=true] { background: var(--ink); color: #fff; box-shadow: none; }
.rate-line { border: 0; background: var(--green-soft); color: var(--gold-text); }
.rate-line strong { color: var(--green); font-size: 20px; }
.btn-primary { background: var(--green); box-shadow: 0 6px 16px rgba(36,84,230,.28); }
.btn-primary:disabled { box-shadow: none; }
.btn-ghost { color: var(--ink); border-color: var(--line); background: #fff; }

.note { font-size: 13px; padding: 0 4px 10px; }
.cards { gap: 8px; }
.card { border: 0; border-radius: 18px; box-shadow: 0 1px 2px rgba(18,20,26,.05); }
.card.is-open { box-shadow: 0 0 0 2px var(--green), 0 8px 24px rgba(36,84,230,.12); }
.card-head {
  display: grid; grid-template-columns: 56px 1fr 20px; align-items: center; gap: 12px;
  width: 100%; padding: 14px 14px 14px 12px; background: none; border: 0; text-align: left;
}
.ch-term { display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 14px; background: #F0F1F4; line-height: 1; }
.ch-term b { font-size: 22px; font-weight: 700; }
.ch-term small { font-size: 10px; color: var(--muted); margin-top: 3px; }
.card.is-open .ch-term { background: var(--ink); color: #fff; }
.card.is-open .ch-term small { color: rgba(255,255,255,.65); }
.ch-main { display: flex; flex-direction: column; min-width: 0; }
.ch-main .pay-sum { font-size: 24px; line-height: 1.15; }
.ch-main .pay-per { font-size: 12.5px; color: var(--muted); }
.ch-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #F0F1F4; color: var(--ink); white-space: nowrap; }
.chip-accent { background: var(--green-soft); color: var(--gold-text); }
.ch-arrow { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); justify-self: center; margin-top: -4px; }
.card.is-open .ch-arrow { transform: rotate(-135deg); margin-top: 4px; }
.facts { padding: 2px 16px 6px; border-top: 1px solid var(--line); }
.facts p { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.facts .fl { flex: 0 0 42%; font-size: 13px; }
.facts .fv { text-align: right; font-weight: 600; font-size: 13.5px; }
.details { border-top: 1px solid var(--line); }
.sched tr.down-row td { background: var(--green-soft); color: var(--gold-text); }
.card.off { border: 1.5px dashed var(--line); box-shadow: none; }
.empty { background: #fff; border: 0; border-radius: 22px; }
.btn-wa { box-shadow: 0 6px 16px rgba(29,168,81,.25); }
@media (min-width: 960px) {
  .brand { margin-bottom: 20px; }
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 359px) {
  .card-head { grid-template-columns: 48px 1fr 16px; gap: 10px; }
  .ch-term { width: 48px; height: 48px; }
  .ch-main .pay-sum { font-size: 21px; }
}
/* ===== Насыщенная палитра: сапфир ===== */
:root { --sapphire: #0B1F5C; --royal: #2F5BEA; --sky: #E7EDFF; --bg: #EDF1FA; --ink: #0E1630; --muted: #5E6784; --line: #E1E6F2; --green: #2F5BEA; --green-soft: #E7EDFF; --gold-text: #1D3DB4; }
body { background: linear-gradient(180deg, #E4EAF8 0, #EDF1FA 320px); }
.brand { background: linear-gradient(135deg, #0B1F5C 0%, #17338F 55%, #2F5BEA 100%); box-shadow: 0 12px 30px rgba(11,31,92,.28); }
.brand::after { background: radial-gradient(circle, rgba(120,170,255,.45), rgba(120,170,255,0) 70%); }
.seg button[aria-checked=true] { background: linear-gradient(135deg, #0B1F5C, #2346C8); color: #fff; }
.btn-primary { background: linear-gradient(135deg, #1C3FC4, #2F5BEA 60%, #4A78FF); box-shadow: 0 8px 20px rgba(47,91,234,.35); }
.btn-primary:disabled { background: #C9D2EA; }
.rate-line { background: var(--sky); }
.rate-line strong { color: #1D3DB4; }
.ch-term { background: var(--sky); color: #1D3DB4; }
.ch-term small { color: #5A6FB8; }
.card.is-open .ch-term { background: linear-gradient(135deg, #0B1F5C, #2F5BEA); color: #fff; }
.ch-main .pay-sum { color: #0B1F5C; }
.card { box-shadow: 0 1px 2px rgba(11,31,92,.06), 0 6px 18px rgba(11,31,92,.05); }
.card.is-open { box-shadow: 0 0 0 2px #2F5BEA, 0 10px 26px rgba(47,91,234,.18); }
input[type=text] { background: #F3F6FD; }
.chip { background: #F1F4FB; }