@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Base palette — dark (default) */
  --bg: #0D1117;
  --bg-2: #0A0E14;
  --card: #161B22;
  --card-2: #1C232D;
  --line: #232A33;
  --line-strong: #303843;
  --accent: #00C8FF;
  --accent-dim: #0a3a47;
  --accent-soft: rgba(0,200,255,0.08);
  --accent-border: rgba(0,200,255,0.28);
  --pos: #22C55E;
  --pos-soft: rgba(34,197,94,0.06);
  --pos-border: rgba(34,197,94,0.4);
  --neg: #EF4444;
  --text: #F2F5F8;
  --text-2: #9DA7B3;
  --text-3: #687180;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Semantic surface tokens */
  --tabbar: rgba(0,0,0,0.18);
  --hover: rgba(255,255,255,0.03);
  --row-sep: rgba(255,255,255,0.04);
  --card-grad: linear-gradient(180deg, #161B22, #131820);
  --result-bg: radial-gradient(420px 220px at 80% -20%, rgba(0,200,255,0.08), transparent 70%), #0A0E14;
  --nav-bg: rgba(13,17,23,0.82);
  --nav-shadow: none;
  --shadow: 0 24px 60px -28px rgba(0,0,0,0.7);
  --fxpro-row: rgba(0,200,255,0.07);
  --cta-bg: linear-gradient(120deg, #10202a 0%, #0e1620 60%);
  --cta-border: rgba(0,200,255,0.22);
  --cta-h2: #F2F5F8;
  --cta-p: #9DA7B3;
}

html[data-theme="light"] {
  --bg: #F6F7F9;
  --bg-2: #EDEEF1;
  --card: #FFFFFF;
  --card-2: #F1F4F7;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --accent: #0099CC;
  --accent-dim: #EFF9FF;
  --accent-soft: rgba(0,153,204,0.09);
  --accent-border: rgba(0,153,204,0.35);
  --pos: #16A34A;
  --pos-soft: rgba(22,163,74,0.08);
  --pos-border: rgba(22,163,74,0.38);
  --neg: #DC2626;
  --text: #0D1117;
  --text-2: #4B5563;
  --text-3: #9CA3AF;
  --tabbar: rgba(0,0,0,0.04);
  --hover: rgba(0,0,0,0.025);
  --row-sep: rgba(0,0,0,0.05);
  --card-grad: linear-gradient(180deg, #FFFFFF, #FBFCFD);
  --result-bg: radial-gradient(420px 220px at 80% -20%, rgba(0,153,204,0.10), transparent 70%), #F4FAFD;
  --nav-bg: rgba(246,247,249,0.85);
  --nav-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 6px 20px -12px rgba(15,23,42,0.14);
  --shadow: 0 22px 50px -30px rgba(15,23,42,0.28);
  --fxpro-row: #EFF9FF;
  --cta-bg: linear-gradient(120deg, #EFF9FF 0%, #F0FBFD 60%);
  --cta-border: rgba(0,153,204,0.25);
  --cta-h2: #0D1117;
  --cta-p: #4B5563;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
  overflow-x: clip;
  scrollbar-gutter: stable;
}
html::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: var(--bg-2); }
html::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
html::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}
/* Smooth theme transitions */
.nav, .calc, .widget, .wcontrol, .control, .tab, .wseg, .seg,
.result, .inputs, .dt th, .dt td, .pair-badge, .grp td,
.drawer, .nav-dropdown-menu, .calc-card, .rs-card-head {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--nav-shadow);
}
.nav-inner {
  display: flex; align-items: center; gap: 28px;
  height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  white-space: nowrap;
}
.logo-img {
  width: 32px; height: 32px; border-radius: 7px;
  object-fit: cover; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,200,255,0.2), 0 4px 12px rgba(0,200,255,0.14);
}
.flag-za { width: 22px; height: 16px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.nav-links {
  display: flex; align-items: center; gap: 4px;
  margin-left: 8px;
}
.nav-links a {
  color: var(--text-2); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); background: var(--card); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); font-size: 14px; font-weight: 600;
  padding: 9px 16px; border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: transparent; transition: border-color .15s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.nav-cta:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 18px rgba(0,200,255,0.12); }
.nav-burger {
  display: none; margin-left: auto; background: transparent;
  border: 1px solid var(--line-strong); border-radius: 9px;
  width: 40px; height: 40px; color: var(--text); place-items: center;
}

/* Theme toggle button */
.theme-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--line-strong); background: var(--card);
  display: grid; place-items: center; color: var(--text-2);
  transition: color .15s, border-color .15s, background .15s;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent-border); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .i-sun { display: none; }
.theme-btn .i-moon { display: none; }
html[data-theme="dark"] .theme-btn .i-sun { display: block; }
html[data-theme="light"] .theme-btn .i-moon { display: block; }

/* Nav dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown > a {
  display: inline-flex; align-items: center; gap: 5px;
}
.nav-dropdown > a svg { transition: transform .15s; flex-shrink: 0; }
.nav-dropdown-menu {
  position: absolute; top: 100%; left: -8px;
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 6px; padding-top: 14px; min-width: 210px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s;
  z-index: 60;
  /* Invisible top bridge so cursor can travel from trigger to menu */
  margin-top: -8px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.nav-dropdown:hover > a svg,
.nav-dropdown:focus-within > a svg { transform: rotate(180deg); }
.nav-dropdown-menu a {
  display: block; padding: 10px 14px; border-radius: 8px;
  color: var(--text-2) !important; font-size: 14px; font-weight: 500;
  transition: color .15s, background .15s;
}
.nav-dropdown-menu a:hover { color: var(--text) !important; background: var(--card-2); }

/* Mobile drawer */
.drawer-overlay {
  display: none; position: fixed; inset: 0; z-index: 49;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
  width: 280px; background: var(--card);
  border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; padding: 20px;
  gap: 6px;
  overflow-y: auto; scrollbar-width: thin;
}
.drawer.open { transform: translateX(0); }
.drawer-close {
  align-self: flex-end; background: transparent; border: 1px solid var(--line-strong);
  border-radius: 8px; width: 36px; height: 36px; color: var(--text-2);
  display: grid; place-items: center; margin-bottom: 10px;
}
/* Accordion sections */
.drawer-acc-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: transparent; border: 0; border-radius: 10px;
  padding: 12px 14px; color: var(--text); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.drawer-acc-btn:hover { background: var(--card-2); }
.drawer-acc-btn .acc-icon { flex-shrink: 0; color: var(--text-3); transition: transform .2s; }
.drawer-acc-btn.open .acc-icon { transform: rotate(180deg); }
.drawer-acc-body {
  display: none; flex-direction: column; gap: 2px;
  padding: 4px 0 6px 10px;
}
.drawer-acc-body.open { display: flex; }
.drawer-acc-group {
  font-size: 10px; font-family: var(--mono); text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-3); padding: 8px 14px 4px;
}
.drawer a {
  color: var(--text-2); font-size: 14.5px; font-weight: 500;
  padding: 10px 14px; border-radius: 8px; transition: color .15s, background .15s;
}
.drawer a:hover { color: var(--text); background: var(--card-2); }
.drawer .drawer-cta {
  margin-top: 12px; color: var(--accent); font-weight: 600;
  border: 1px solid rgba(0,200,255,0.3); border-radius: 10px;
  padding: 13px 14px; text-align: center;
}

/* ============ HERO ============ */
.page-hero { padding: 48px 0 40px; border-bottom: 1px solid var(--line); }
.hero { padding: 40px 0 64px; position: relative; }
.hero--bare { padding: 0 0 32px; }
.hero--bare::before { display: none; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(620px 320px at 78% -8%, rgba(0,200,255,0.10), transparent 70%),
    radial-gradient(520px 300px at 8% 4%, rgba(0,200,255,0.05), transparent 70%);
}
.hero-head {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 22px; flex-wrap: wrap;
}
.hero-head h1 {
  font-size: clamp(26px, 3.4vw, 38px); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
}
.hero-head p { color: var(--text-2); font-size: 15px; margin-top: 8px; max-width: 540px; }
.hero-head .live {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-3); font-size: 12.5px; font-family: var(--mono);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px;
  white-space: nowrap;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pos); box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ============ CALCULATOR WIDGET ============ */
.calc {
  position: relative;
  background: var(--card-grad);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tabs {
  display: flex; gap: 2px; padding: 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
  background: var(--tabbar);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px; border-radius: 10px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-2); font-size: 14px; font-weight: 600;
  white-space: nowrap; transition: color .15s, background .15s, border-color .15s;
}
.tab .tnum { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.tab:hover { color: var(--text); background: var(--card-2); }
.tab.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(0,200,255,0.28); }
.tab.active .tnum { color: var(--accent); }

.calc-body { display: grid; grid-template-columns: 1.05fr 0.95fr; }
.inputs { padding: 26px 28px; border-right: 1px solid var(--line); }
.panel-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 20px;
}
.panel-title .bar { width: 18px; height: 2px; background: var(--accent); border-radius: 2px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; letter-spacing: 0.01em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.control {
  position: relative; display: flex; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line-strong);
  border-radius: 11px; transition: border-color .15s, box-shadow .15s;
  min-height: 50px;
}
.control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,200,255,0.12); }
.control .prefix { padding-left: 14px; color: var(--text-3); font-family: var(--mono); font-size: 14px; font-weight: 500; pointer-events: none; }
.control input, .control select {
  width: 100%; background: transparent; border: 0; outline: none;
  color: var(--text); font-family: var(--mono); font-size: 16px; font-weight: 500;
  padding: 14px; min-height: 48px;
}
.control .prefix + input { padding-left: 8px; }
.control select { appearance: none; -webkit-appearance: none; cursor: pointer; font-family: var(--sans); font-weight: 600; font-size: 15px; padding-right: 40px; }
.control.sel::after {
  content: ""; position: absolute; right: 16px; top: 50%;
  width: 8px; height: 8px; border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3); transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.control select option { background: var(--card); color: var(--text); }
.control select optgroup { background: var(--bg-2); color: var(--text-3); font-weight: 700; }
.control .suffix { padding-right: 14px; color: var(--text-3); font-family: var(--mono); font-size: 13px; white-space: nowrap; pointer-events: none; }

.seg { display: flex; gap: 6px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 11px; padding: 5px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 14px; transition: all .15s; }
.seg button.on { color: var(--text); background: var(--card-2); }
.seg button[data-v="Buy"].on { color: var(--pos); background: rgba(34,197,94,0.12); }
.seg button[data-v="Sell"].on { color: var(--neg); background: rgba(239,68,68,0.12); }

/* RESULT PANEL */
.result {
  padding: 26px 28px; display: flex; flex-direction: column;
  background: radial-gradient(420px 220px at 80% -20%, rgba(0,200,255,0.08), transparent 70%), var(--bg-2);
  position: relative;
}
.result .panel-title { color: var(--text-3); }
.result-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 8px 0; }
.result-label { font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 10px; }
.result-value {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(34px, 5.4vw, 52px); line-height: 1; letter-spacing: -0.02em;
  color: var(--pos); font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.result-value.cyan { color: var(--accent); }
.result-value.neg { color: var(--neg); }
.result-value .cur { font-size: 0.52em; color: var(--text-2); font-weight: 500; }
.result-sub { font-family: var(--mono); font-size: 16px; color: var(--text-2); margin-top: 12px; font-variant-numeric: tabular-nums; }
.result-sub b { color: var(--text); font-weight: 700; }

.result-meta {
  margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-strong);
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
}
.meta-item .k { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.meta-item .v { font-family: var(--mono); font-size: 15px; color: var(--text); margin-top: 3px; font-variant-numeric: tabular-nums; }

.result-cta {
  margin-top: 22px;
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--accent); font-size: 13.5px; font-weight: 500;
  transition: gap .15s, color .15s;
}
.result-cta:hover { gap: 11px; color: #5fdcff; }
.result-cta .reg { color: var(--text-3); font-weight: 400; }

/* pane visibility */
.pane { display: none; }
.pane.active { display: contents; }

/* ============ SECTIONS ============ */
.section { padding: 72px 0; border-top: 1px solid var(--line); }
.section-eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.section h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -0.02em; }
.section .lede { color: var(--text-2); font-size: 16px; max-width: 560px; margin-top: 12px; }

/* calc grid */
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 36px; }
.calc-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; transition: border-color .18s, transform .18s, box-shadow .18s, background .18s;
  display: flex; flex-direction: column; gap: 14px; cursor: pointer;
  text-align: left;
}
.calc-card:hover { border-color: rgba(0,200,255,0.55); transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(0,200,255,0.35); background: var(--card-2); }
.cc-icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid rgba(0,200,255,0.2); color: var(--accent);
}
.cc-icon svg { width: 20px; height: 20px; }
.calc-card h3 { font-size: 16px; font-weight: 600; }
.calc-card p { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.cc-go { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; transition: gap .15s; }
.calc-card:hover .cc-go { gap: 10px; }

/* why section */
.why-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 56px; margin-top: 12px; align-items: start; }
.why-copy { columns: 2; column-gap: 36px; }
.why-copy h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; break-after: avoid; }
.why-copy p { font-size: 14.5px; color: var(--text-2); line-height: 1.6; margin-bottom: 20px; break-inside: avoid; }
.why-copy p:last-child { margin-bottom: 0; }
.why-aside { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px; position: sticky; top: 84px; }
.why-aside .qa { padding: 16px 0; border-bottom: 1px solid var(--line); }
.why-aside .qa:first-child { padding-top: 0; }
.why-aside .qa:last-child { padding-bottom: 0; border-bottom: 0; }
.why-aside .q { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.why-aside .a { font-size: 13.5px; color: var(--text-2); line-height: 1.55; }

/* FxPro CTA */
.cta-banner { border-top: 1px solid var(--line); }
.cta-inner {
  margin: 0 auto; max-width: 1200px;
  background: var(--cta-bg);
  border: 1px solid var(--cta-border); border-radius: 18px;
  padding: 44px 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  position: relative; overflow: hidden;
}
.cta-inner::after {
  content:""; position:absolute; right:-60px; top:-60px; width:320px; height:320px;
  background: radial-gradient(circle, rgba(0,200,255,0.16), transparent 65%); pointer-events:none;
}
.cta-inner h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--cta-h2); }
.cta-inner p { color: var(--cta-p); font-size: 15px; margin-top: 10px; max-width: 520px; }
.btn-primary {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--accent); color: #ffffff; font-weight: 700; font-size: 15px;
  padding: 15px 26px; border-radius: 11px; border: 0;
  box-shadow: 0 10px 30px -8px rgba(0,200,255,0.5); transition: transform .15s, box-shadow .15s, filter .15s;
  white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 16px 40px -10px rgba(0,200,255,0.6); }
html[data-theme="dark"] .btn-primary { color: #0D1117; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 56px 0 40px; background: var(--bg-2); }
.footer-top { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; }
.fl-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 14px; }
.fl-col a { display: block; color: var(--text-2); font-size: 14px; padding: 5px 0; transition: color .15s; }
.fl-col a:hover { color: var(--accent); }
.disclaimer { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.disclaimer p { font-size: 12px; color: var(--text-3); line-height: 1.6; max-width: 920px; }
.disclaimer .disc-label { color: var(--text-2); font-weight: 600; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.footer-bottom { margin-top: 26px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-3); font-size: 12.5px; }

/* ============ ARTICLE PROSE RHYTHM ============ */
/* min-width:0 — критически важно для grid-item, иначе содержимое распирает ячейку */
.article { min-width: 0; }
.article h2 { font-size: clamp(18px, 2.2vw, 24px); font-weight: 700; letter-spacing: -0.01em; margin-top: 44px; margin-bottom: 14px; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: clamp(15px, 1.6vw, 18px); font-weight: 700; margin-top: 28px; margin-bottom: 10px; }
.article p { margin-bottom: 14px; line-height: 1.7; color: var(--text-2); }
.article p:last-child { margin-bottom: 0; }
.article strong { color: var(--text); }
.article ul, .article ol { margin: 12px 0 16px 22px; }
.article li { margin-bottom: 5px; line-height: 1.6; color: var(--text-2); }
/* таблицы в статьях — горизонтальный скролл вместо overflow */
.article table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.article .dt { margin: 20px 0 24px; }

/* LotDesk JS-generated table rows — Astro scoped CSS doesn't reach these */
#lotdesk .ld-rr td { font-family:'JetBrains Mono',ui-monospace,monospace; font-size:13px; padding:8px 12px; border-bottom:1px solid var(--line); font-variant-numeric:tabular-nums; }
#lotdesk .ld-rr tr:last-child td { border-bottom:0; }
#lotdesk .ld-streak td { font-family:'JetBrains Mono',ui-monospace,monospace; font-size:12.5px; padding:6px 12px; border-bottom:1px solid var(--line); font-variant-numeric:tabular-nums; }
#lotdesk .ld-streak tr:last-child td { border-bottom:0; }

/* ============ INFO SIDEBAR TOC (JS-generated, must be unscoped) ============ */
.toc-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.toc-card h5 { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 10px; }
.toc-ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; display: flex; flex-direction: column; gap: 2px; }
.toc-ol li { counter-increment: toc; }
.toc-ol li a { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 7px; font-size: 13px; color: var(--text-2); line-height: 1.4; transition: color .15s, background .15s; text-decoration: none; }
.toc-ol li a::before { content: counter(toc, decimal-leading-zero); font-family: var(--mono); font-size: 11px; color: var(--text-3); flex-shrink: 0; transition: color .15s; }
.toc-ol li a:hover { color: var(--text); background: var(--card-2); }
.toc-ol li a:hover::before { color: var(--accent); }
.toc-ol li a.toc-active { color: var(--accent); background: var(--accent-soft); }
.toc-ol li a.toc-active::before { color: var(--accent); }

/* ============ LIGHTBOX ============ */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 70vw; max-height: 75vh; object-fit: contain;
  border-radius: 12px; box-shadow: 0 32px 80px rgba(0,0,0,0.8);
  pointer-events: none;
}
.lb-close {
  position: absolute; top: 20px; right: 24px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.28);
  color: #fff; font-size: 18px; width: 44px; height: 44px;
  border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  transition: background .15s;
}
.lb-close:hover { background: rgba(255,255,255,0.26); }
@media (max-width: 760px) {
  .lightbox img { max-width: 94vw; max-height: 80vh; }
}

/* ============ MOBILE STICKY CTA ============ */
.sticky-cta-mobile {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: var(--nav-shadow);
}
.sticky-cta-mobile .btn-primary { width: 100%; justify-content: center; }
.sticky-banner-link { display: block; }
.sticky-banner-img { display: block; width: 100%; height: auto; border-radius: 0; }

/* ============ INFO PAGE LAYOUT (article + sidebar) ============ */
.info-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
  padding: 64px 0;
}
/* sidebar wrapper fills full column height so .banner-sticky inside can travel */
.info-layout .article-sidebar-sticky {
  align-self: stretch;
}
.info-layout .article-sidebar-sticky .info-sidebar {
  height: 100%;
}
@media (max-width: 960px) {
  .info-layout { grid-template-columns: 1fr; }
  .info-layout .article-sidebar-sticky { display: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  body { padding-bottom: 76px; }
  .sticky-cta-mobile { display: block; }
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-burger { display: grid; }
  .nav-inner { gap: 8px; }
  .why-grid { grid-template-columns: 1fr; gap: 32px; }
  .why-aside { position: static; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .calc-body { grid-template-columns: 1fr; }
  .inputs { border-right: 0; border-bottom: 1px solid var(--line); }
  .why-copy { columns: 1; }
  .cta-inner { flex-direction: column; align-items: flex-start; padding: 32px 26px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 26px 0 44px; }
  .inputs, .result { padding: 22px 18px; }
  .calc-grid { grid-template-columns: 1fr; }
  .footer-links { gap: 28px; }
  .result-value { font-size: clamp(32px, 11vw, 44px); }
}

/* ============ WIDGET DESIGN SYSTEM (from Claude Design) ============ */

.widget {
  background: var(--card-grad);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.wbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 20px; background: var(--tabbar);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.wbar-title { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-2); }
.wbar-title .idx { color: var(--accent); margin-right: 8px; }
.wbar-meta { font-family: var(--mono); font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.wbar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); flex-shrink: 0; }
.wbar-dot.live { animation: wdotpulse 2.2s infinite; }
.wbar-dot.stale { background: #F59E0B; }
@keyframes wdotpulse { 0%{box-shadow:0 0 0 0 rgba(34,197,94,0.5);} 70%{box-shadow:0 0 0 5px rgba(34,197,94,0);} 100%{box-shadow:0 0 0 0 rgba(34,197,94,0);} }
.wpad { padding: 22px; }

/* twin panels */
.twin { display: grid; grid-template-columns: 1fr 1fr; }
.twin > .wcol:first-child { border-right: 1px solid var(--line); }
.wcol-head { padding: 14px 20px; background: var(--tabbar); border-bottom: 1px solid var(--line); }

/* widget inputs */
.wfield { margin-bottom: 14px; }
.wfield:last-child { margin-bottom: 0; }
.wfield > label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; }
.wrow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wcontrol { position: relative; display: flex; align-items: center; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 11px; min-height: 50px; transition: border-color .15s, box-shadow .15s; }
.wcontrol:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,200,255,0.12); }
.wcontrol .wpfx { padding-left: 14px; color: var(--text-3); font-family: var(--mono); font-size: 14px; pointer-events: none; }
.wcontrol input, .wcontrol select { width: 100%; background: transparent; border: 0; outline: none; color: var(--text); font-family: var(--mono); font-size: 16px; font-weight: 500; padding: 13px 14px; min-height: 48px; }
.wcontrol .wpfx + input { padding-left: 8px; }
.wcontrol select { appearance: none; -webkit-appearance: none; cursor: pointer; font-family: var(--sans); font-weight: 600; font-size: 15px; padding-right: 38px; }
.wcontrol.wsel::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: translateY(-65%) rotate(45deg); pointer-events: none; }
.wcontrol select option { background: var(--card); color: var(--text); }
.wcontrol select optgroup { background: var(--bg-2); color: var(--text-3); font-weight: 700; }
.wcontrol .wsfx { padding-right: 14px; color: var(--text-3); font-family: var(--mono); font-size: 13px; white-space: nowrap; pointer-events: none; }
.wseg { display: flex; gap: 6px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 11px; padding: 5px; }
.wseg button { flex: 1; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13.5px; transition: all .15s; font-family: var(--mono); }
.wseg button.on { color: var(--accent); background: rgba(0,200,255,0.12); }
.wseg.bs button { font-family: var(--sans); }
.wseg.bs button[data-v="Buy"].on { color: var(--pos); background: rgba(34,197,94,0.14); }
.wseg.bs button[data-v="Sell"].on { color: var(--neg); background: rgba(239,68,68,0.14); }

/* result numbers */
.num-xl { font-family: var(--mono); font-weight: 700; font-size: 36px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.num-xl .u { font-size: 0.5em; color: var(--text-2); font-weight: 500; margin-left: 2px; }
.c-pos { color: var(--pos); } .c-neg { color: var(--neg); } .c-cyan { color: var(--accent); } .c-warn { color: #F59E0B; }
.res-label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 9px; font-family: var(--mono); }
.wmgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.wmitem .k { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.wmitem .v { font-family: var(--mono); font-size: 15px; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* data tables */
.dt { width: 100%; border-collapse: collapse; }
.dt th { text-align: left; font-family: var(--mono); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 12px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dt td { padding: 12px 20px; font-family: var(--mono); font-size: 14px; border-bottom: 1px solid var(--row-sep); font-variant-numeric: tabular-nums; color: var(--text-2); }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt .ta-r { text-align: right; }
.dt tbody tr.hov:hover td { background: var(--hover); }
.dt tr.tint td { background: rgba(0,200,255,0.045); }
.grp td { padding: 10px 20px; font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; border-bottom: 0 !important; }
.grp.zar td { color: var(--pos); background: var(--pos-soft); }
.grp.maj td { color: var(--accent); background: var(--accent-soft); }
.pair-badge { display: inline-block; font-family: var(--mono); font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 7px; border: 1px solid; }
.pair-badge.zar { color: var(--pos); border-color: var(--pos-border); background: var(--pos-soft); }
.pair-badge.maj { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.col-bright { color: var(--text); }
.dt td.dim { color: var(--text-2); }
.scroll-tbl { max-height: 520px; overflow-y: auto; }
.scroll-tbl::-webkit-scrollbar { width: 10px; }
.scroll-tbl::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 3px solid var(--card); }
.scroll-tbl thead th { position: sticky; top: 0; background: var(--card); z-index: 2; }

/* gauge */
.gauge-track { height: 12px; border-radius: 999px; background: var(--line-strong); overflow: hidden; margin: 14px 0 8px; }
.gauge-fill { height: 100%; border-radius: 999px; transition: width .25s ease, background .25s; }
.gauge-marks { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-top: 16px; }
.status-pill .sd { width: 8px; height: 8px; border-radius: 50%; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row .kk { color: var(--text-2); flex-shrink: 1; min-width: 0; }
.kv-row .vv { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; min-width: 0; word-break: break-word; overflow-wrap: anywhere; flex-shrink: 0; }
@media (max-width: 560px) {
  .kv-row { flex-direction: column; gap: 3px; }
  .kv-row .vv { text-align: left; flex-shrink: 1; }
}
.wdivider { border-top: 1px dashed var(--line-strong); margin: 18px 0; }
.sec-label { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 12px; }
.w5-layout { display: grid; grid-template-columns: 300px 1fr; }
.w5-layout > .wcol:first-child { border-right: 1px solid var(--line); }
.wnote { font-size: 12px; color: var(--text-3); margin-top: 6px; }

@media (max-width: 760px) {
  .twin, .w5-layout { grid-template-columns: 1fr; }
  .twin > .wcol:first-child, .w5-layout > .wcol:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .dt th, .dt td { padding: 11px 14px; }
  .matrix-wrap { overflow-x: auto; }
  .matrix-wrap .dt { min-width: 540px; }
}
