/* ─────────────────────────────────────────────────────────────
   DEX · BDM - Style system
   ───────────────────────────────────────────────────────────── */

:root {
  --bg:            #ffffff;
  --surface:       #f7f9fc;
  --surface-2:     #eef2f7;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --text:          #0f172a;
  --muted:         #64748b;
  --primary:       #1e3a8a;
  --primary-2:     #2563eb;
  --positive:      #047857;
  --warn:          #b45309;
  --danger:        #b91c1c;

  --radius:    12px;
  --radius-sm:  8px;
  --radius-xs:  5px;

  --shadow-xs: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 1px 3px rgba(15,23,42,.04), 0 6px 20px rgba(15,23,42,.07);
  --shadow-lg: 0 4px 12px rgba(15,23,42,.08), 0 16px 40px rgba(15,23,42,.10);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .875em; background: var(--surface-2); padding: 1px 5px;
  border-radius: var(--radius-xs);
}

/* ── Layout ──────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
section { padding: 56px 0; border-top: 1px solid var(--border); }
section:first-of-type { border-top: 0; }

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4 { color: var(--text); line-height: 1.2; margin: 0; }
h1 { font-size: 38px; font-weight: 700; letter-spacing: -.6px;  margin-bottom: 14px; }
h2 { font-size: 24px; font-weight: 700; letter-spacing: -.3px;  margin-bottom: 16px; }
h3 { font-size: 17px; font-weight: 600;                          margin-bottom: 10px; }
h4 { font-size: 11.5px; font-weight: 700; text-transform: uppercase;
     letter-spacing: .8px; color: var(--muted);                  margin-bottom: 8px; }

/* top margin when h3 is not the first element */
* + h3 { margin-top: 22px; }
h3:first-child { margin-top: 0; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 12px; padding-left: 22px; }
li { margin: 5px 0; line-height: 1.55; }

/* utility: muted small text, replaces inline style="font-size:13.5px;color:var(--muted)" */
.note { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 10px; }
.note + .note { margin-top: 8px; }

/* ── Navigation ──────────────────────────────────────────────── */
nav.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.93);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
nav.top .inner {
  max-width: 1080px; margin: 0 auto;
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
}
nav.top .inner::-webkit-scrollbar { display: none; }
nav.top .brand { display: flex; align-items: center; margin-right: 14px; flex-shrink: 0; }
nav.top .brand img,
nav.top .brand svg { height: 24px; width: auto; display: block; }
nav.top .brand:hover { opacity: .8; text-decoration: none; }
nav.top a.link {
  flex-shrink: 0; color: var(--muted); font-size: 13.5px; font-weight: 500;
  padding: 6px 11px; border-radius: var(--radius-sm); white-space: nowrap;
  transition: color .12s, background .12s;
}
nav.top a.link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
nav.top a.link.active {
  color: var(--primary-2); background: rgba(37,99,235,.08); font-weight: 600;
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(1200px 500px at 85% -5%,  rgba(37,99,235,.09), transparent 55%),
    radial-gradient(800px  400px at -5%  10%,  rgba(14,165,233,.07), transparent 55%);
}
.hero .eyebrow {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--primary-2); background: rgba(37,99,235,.08);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
}
.hero .lead {
  font-size: 17px; line-height: 1.65; color: var(--muted); max-width: 680px; margin: 0;
}

/* ── Grid & cards ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-xs);
}
.card h3          { font-size: 15px; font-weight: 600; margin-bottom: 8px; margin-top: 0; }
.card p           { font-size: 14px; }
.card ul, .card ol { font-size: 14px; }

.callout {
  border-left: 3px solid var(--primary-2); background: rgba(37,99,235,.05);
  padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0; font-size: 14.5px; line-height: 1.6;
}
.callout.warn     { border-left-color: var(--warn);     background: rgba(180,83,9,.06); }
.callout.positive { border-left-color: var(--positive); background: rgba(4,120,87,.06); }

/* Pills */
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
        border-radius: 999px; border: 1px solid var(--border-strong);
        background: var(--surface); color: var(--muted); }
.pill.aplus { color: #6d28d9; border-color: #ddd6fe; background: #f5f3ff; }
.pill.a     { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.pill.b     { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface); font-weight: 600; color: var(--muted);
     font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.num-col { text-align: right; font-variant-numeric: tabular-nums; }

/* Formula code block */
.formula {
  background: #0d1526; color: #e2e8f0; border-radius: var(--radius);
  padding: 20px 22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px; line-height: 1.8; overflow-x: auto; margin: 16px 0;
}
.formula .k { color: #93c5fd; }
.formula .v { color: #fde68a; }
.formula .c { color: #526175; }

/* ── Tiles – home page ───────────────────────────────────────── */
.flow-3 { display: flex; flex-direction: column; gap: 20px; margin-top: 12px; }
.flow-3 .tile-entry {
  max-width: 520px; width: 100%; margin: 0 auto;
  border: 2px solid var(--primary-2);
}
.flow-3 .tile-entry .tile-eyebrow { color: var(--primary); }

.flow-connector { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.flow-line    { flex: 1; height: 1px; background: var(--border-strong); }
.flow-caption { padding: 0 12px; font-style: italic; text-align: center; line-height: 1.4; }

.tiles-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tile {
  display: flex; flex-direction: column; padding: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: inherit;
  box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-lg);
  border-color: var(--border-strong); text-decoration: none;
}
.tile .tile-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--primary-2); margin-bottom: 6px;
}
.tile .tile-num {
  font-size: 42px; font-weight: 700; letter-spacing: -1.5px;
  color: var(--primary); line-height: 1; margin: 6px 0 12px;
}
.tile h3    { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.tile p     { font-size: 14px; color: var(--muted); flex: 1; margin-bottom: 14px; }
.tile ul    { font-size: 13.5px; padding-left: 18px; margin-bottom: 16px; }
.tile .arrow { font-size: 14px; font-weight: 600; color: var(--primary-2); margin-top: auto; }
.tile:hover .arrow { color: var(--primary); }

/* ── Scheme / process diagram ────────────────────────────────── */
.scheme-section { padding: 40px 0; }
.scheme {
  display: grid; gap: 12px;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch; margin: 12px 0 0;
}
.scheme.cols-4 { grid-template-columns: repeat(4, 1fr); }
.scheme-step {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.scheme-step::after {
  content: '→'; position: absolute; right: -13px; top: 50%;
  transform: translateY(-50%);
  color: var(--border-strong); font-size: 16px; z-index: 1; background: transparent;
}
.scheme-step:last-child::after { display: none; }
.scheme-step .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); color: var(--primary-2); border: 1.5px solid var(--border-strong);
  font-size: 11px; font-weight: 700; margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.scheme-step .ttl  { font-size: 13px;   font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.scheme-step .desc { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.scheme-step.final {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  border-color: transparent;
}
.scheme-step.final .num  { background: rgba(255,255,255,.15); color: white; border-color: rgba(255,255,255,.3); }
.scheme-step.final .ttl  { color: white; }
.scheme-step.final .desc { color: rgba(255,255,255,.8); }
.scheme-step.final::after { display: none; }
.scheme-step .formula-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5;
}
.scheme-step .formula-line b { color: var(--text); font-weight: 600; }

/* ── Calculator ──────────────────────────────────────────────── */
.calc {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.calc .head {
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; font-size: 14px;
}
.calc .body { display: grid; grid-template-columns: 1fr 1fr; }
.calc .col   { padding: 22px 24px; }
.calc .col.inputs  { border-right: 1px solid var(--border); }
.calc .col.outputs { background: var(--surface); }
.calc fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.calc legend {
  display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; padding: 0;
}
.field { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; margin: 8px 0; }
.field label    { font-size: 14px; font-weight: 500; }
.field .hint    { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.field input[type="number"],
.field select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px; background: var(--bg);
  transition: border-color .12s, box-shadow .12s;
}
.field input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field input[type="number"]:disabled {
  background: var(--surface); color: var(--muted);
  border-color: var(--border); cursor: not-allowed; opacity: 1;
}
.radio-group { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-group label {
  flex: 1; min-width: 80px; padding: 7px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  text-align: center; font-size: 13px; cursor: pointer; background: var(--bg);
  transition: all .12s;
}
.radio-group input { display: none; }
.radio-group label:has(input:checked) { background: var(--primary-2); color: white; border-color: var(--primary-2); }

.out-row { display: flex; align-items: baseline; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); gap: 12px; }
.out-row:last-child { border-bottom: 0; }
.out-row .lbl { color: var(--muted); font-size: 13.5px; }
.out-row .val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.out-row.total { border-top: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong); margin-top: 6px; padding: 10px 0; }
.out-row.total .val { font-size: 17px; }

.highlight {
  background: linear-gradient(135deg, rgba(37,99,235,.07), rgba(14,165,233,.07));
  border: 1px solid rgba(37,99,235,.18); border-radius: var(--radius);
  padding: 16px 18px; margin: 14px 0;
}
.highlight .big { font-size: 26px; font-weight: 700; color: var(--primary); letter-spacing: -.5px; margin: 4px 0; }
.highlight .sub { font-size: 12px; color: var(--muted); }

.coef-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.col .coef-chips { margin-top: 14px; }
.coef-chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border-strong);
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.coef-chip b { color: var(--text); }

button.btn {
  background: var(--primary-2); color: white; border: 0;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: filter .12s;
}
button.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border-strong); }
button.btn:hover { filter: brightness(.93); }

/* Tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab-btn {
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .12s;
}
.tab-btn:hover  { color: var(--text); background: var(--surface); }
.tab-btn.active { background: var(--primary-2); color: white; border-color: var(--primary-2); }

/* ── Validation list ─────────────────────────────────────────── */
.validation-list {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-top: 20px; box-shadow: var(--shadow-xs);
}
.val-row { display: flex; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.val-row:last-child { border-bottom: 0; }
.val-badge {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-2); color: white; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.val-badge.warn { background: var(--warn); }
.val-body { flex: 1; min-width: 0; }
.val-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.val-title .val-meta { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.val-body ul { margin: 0; padding-left: 18px; }
.val-body ul li { font-size: 13.5px; line-height: 1.5; margin-bottom: 5px; }
.val-body ul li:last-child { margin-bottom: 0; }
.val-flags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.val-flag-step { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.val-flag-step .flag-num {
  font-weight: 700; color: var(--warn); background: rgba(180,83,9,.1);
  border-radius: 4px; padding: 2px 7px; white-space: nowrap;
}
.val-flag-step .flag-label { color: var(--text); }
.val-flag-sep { color: var(--border-strong); }

/* ── Telegram button ─────────────────────────────────────────── */
.tg-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px; border-radius: 999px;
  background: #0099e5; color: white;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  text-decoration: none; transition: filter .12s;
}
.tg-btn:hover { filter: brightness(.88); text-decoration: none; color: white; }
.tg-btn svg { flex-shrink: 0; }
nav.top .tg-btn { margin-left: auto; }
.tg-btn-lg { font-size: 15px; padding: 10px 20px; gap: 7px; }

/* ── Contact banner ──────────────────────────────────────────── */
.contact-banner { padding: 24px 0; background: rgba(0,153,229,.04); }
.contact-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.contact-label { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.contact-sub { font-size: 13.5px; color: var(--muted); }

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  padding: 28px 0 40px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
}
footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--text); text-decoration: none; }

/* ── Responsive · 860px ──────────────────────────────────────── */
@media (max-width: 860px) {
  h1 { font-size: 30px; }
  h2 { font-size: 21px; }
  section { padding: 40px 0; }
  .scheme-section { padding: 28px 0; }
  .hero { padding: 52px 0 40px; }
  .hero .lead { font-size: 16px; max-width: 100%; }

  .grid-2, .tiles-2 { grid-template-columns: 1fr; }

  .flow-connector { flex-direction: column; gap: 6px; }
  .flow-line { width: 1px; height: 14px; flex: 0 0 auto; }
  .flow-caption { padding: 0; font-size: 12.5px; }

  .calc .body { grid-template-columns: 1fr; }
  .calc .col.inputs { border-right: 0; border-bottom: 1px solid var(--border); }

  .scheme, .scheme.cols-4 { grid-template-columns: 1fr; gap: 20px; }
  .scheme-step::after {
    content: '↓'; right: 50%; top: auto; bottom: -16px;
    transform: translateX(50%);
  }
}

/* ── Responsive · 560px ──────────────────────────────────────── */
@media (max-width: 560px) {
  h1 { font-size: 26px; }
  h2 { font-size: 19px; }
  .container { padding: 0 16px; }
  nav.top .inner { padding: 0 16px; }
  .hero { padding: 36px 0 28px; }
  .hero .lead { font-size: 15px; }

  .contact-row { flex-direction: column; align-items: flex-start; gap: 14px; }

  .tile { padding: 18px; }
  .tile .tile-num { font-size: 34px; }
  .tile h3 { font-size: 18px; }

  .calc .col { padding: 16px; }
  .field { grid-template-columns: 1fr 96px; gap: 8px; }
  .field input[type="number"], .field select { font-size: 13px; padding: 7px 8px; }

  .tabs { flex-wrap: wrap; }
  .tab-btn { flex: 1; min-width: 120px; padding: 8px 10px; font-size: 13px; text-align: center; }

  .val-row { padding: 14px 16px; gap: 12px; }
}
