:root {
  --primary: #0f4532;
  --primary-hover: #1a5c44;
  --surface: #f0f4f2;
  --text: #17352b;
  --muted: #61746c;
  --border: #c8d5ce;
  --white: #ffffff;
  --error: #a73737;
  --shadow: 0 20px 60px rgba(15, 69, 50, 0.1);
  font-family: "Plus Jakarta Sans", Inter, Arial, sans-serif;
  color: var(--text);
  background: var(--white);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 85% 4%, rgba(200, 213, 206, 0.38), transparent 22rem),
    var(--white);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.page-shell { max-width: 1440px; margin: 0 auto; padding: 0 56px; }

.site-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.brand { display: inline-flex; gap: 14px; align-items: center; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: 15px; letter-spacing: -.01em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.back-link { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--primary); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr);
  gap: 80px;
  align-items: start;
  padding: 88px 0 76px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.eyebrow span { width: 30px; height: 1px; background: var(--primary); }

h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(54px, 7.3vw, 104px);
  line-height: .94;
  letter-spacing: -.065em;
  font-weight: 600;
}

.hero-description {
  max-width: 650px;
  margin: 32px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.date-panel {
  margin-top: 58px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 14px 45px rgba(15,69,50,.06);
}
.date-panel > label, .converter-field > label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.date-control { position: relative; }
.date-control svg { position: absolute; left: 16px; top: 50%; width: 20px; transform: translateY(-50%); pointer-events: none; }
.date-control input {
  width: 100%;
  height: 58px;
  padding: 0 16px 0 50px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  font-weight: 600;
}
.date-panel p { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.rates-section { padding: 76px 0 92px; border-top: 1px solid var(--border); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 36px; }
.section-heading > div:first-child { display: flex; align-items: baseline; gap: 22px; }
.section-number { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.section-heading h2 { margin: 0; font-size: clamp(32px, 4vw, 50px); line-height: 1; letter-spacing: -.05em; font-weight: 600; }
.section-actions { display: flex; align-items: center; gap: 22px; }
.effective-date { margin: 0; color: var(--muted); font-size: 12px; }
.outline-button, .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.outline-button svg { width: 17px; }
.outline-button:hover { background: var(--surface); }

.status { display: flex; align-items: center; gap: 12px; min-height: 130px; color: var(--muted); font-size: 13px; }
.status[hidden] { display: none; }
.status.error { color: var(--error); }
.loader { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.rates-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.rate-card {
  position: relative;
  min-height: 205px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.rate-card:hover { transform: translateY(-3px); border-color: #a9beb4; box-shadow: var(--shadow); }
.rate-card::after {
  content: attr(data-symbol);
  position: absolute;
  right: 14px;
  bottom: -30px;
  color: var(--surface);
  font-size: 110px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.rate-top, .rate-value, .rate-name { position: relative; z-index: 1; }
.rate-top { display: flex; align-items: center; justify-content: space-between; }
.rate-code { font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.rate-flag { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); font-size: 17px; }
.rate-value { margin: 38px 0 7px; font-size: clamp(26px, 2.5vw, 36px); line-height: 1; letter-spacing: -.045em; font-weight: 600; font-variant-numeric: tabular-nums; }
.rate-value small { color: var(--muted); font-size: 14px; font-weight: 500; }
.rate-name { max-width: 85%; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.converter-section {
  margin: 0 -56px;
  padding: 80px 56px 86px;
  border-radius: 28px 28px 0 0;
  color: var(--white);
  background: var(--primary);
}
.converter-heading { align-items: center; }
.converter-heading > p { max-width: 260px; margin: 0; color: rgba(255,255,255,.65); font-size: 12px; line-height: 1.55; text-align: right; }
.section-number-light { color: rgba(255,255,255,.55); }
.converter-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr 52px 1fr;
  align-items: end;
  gap: 16px;
  padding: 30px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 18px;
  background: rgba(255,255,255,.075);
}
.converter-field > label { color: rgba(255,255,255,.62); }
.converter-field input, .converter-field select {
  width: 100%; height: 62px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; color: var(--white); background: rgba(255,255,255,.08); font-size: 17px; font-weight: 600;
}
.converter-field input { padding: 0 18px; }
.converter-field .currency-combobox { padding-right: 48px; text-transform: uppercase; }
.converter-field .currency-combobox::placeholder { color: rgba(255,255,255,.5); text-transform: none; }
.converter-field select { appearance: none; padding: 0 45px 0 18px; }
.converter-field select option { color: var(--text); background: var(--white); }
.select-wrap { position: relative; }
.select-wrap svg { position: absolute; top: 50%; right: 16px; width: 18px; transform: translateY(-50%); pointer-events: none; }
.currency-search-wrap::after {
  content: "Введите код или название";
  position: absolute;
  left: 18px;
  bottom: -18px;
  color: rgba(255,255,255,.48);
  font-size: 9px;
  pointer-events: none;
}
.swap-button {
  width: 52px; height: 52px; margin-bottom: 5px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: var(--white); background: transparent;
  transition: transform .2s, background .2s;
}
.swap-button:hover { transform: rotate(180deg); background: rgba(255,255,255,.1); }
.swap-button svg { width: 22px; margin: auto; }
.result-block { grid-column: 1 / -1; padding-top: 26px; margin-top: 12px; border-top: 1px solid rgba(255,255,255,.18); }
.result-block > span { display: block; color: rgba(255,255,255,.6); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.result-block strong { display: block; margin: 8px 0; overflow-wrap: anywhere; font-size: clamp(36px, 5vw, 68px); line-height: 1.05; letter-spacing: -.05em; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-block small { color: rgba(255,255,255,.65); font-size: 12px; }

footer { display: flex; justify-content: space-between; gap: 20px; margin: 0 -56px; padding: 25px 56px; color: var(--muted); background: var(--surface); font-size: 11px; }
footer p { margin: 0; }
footer a { font-weight: 700; }

.date-toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  width: min(440px, calc(100% - 32px));
  padding: 16px 14px 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--white);
  box-shadow: 0 18px 55px rgba(15,69,50,.2);
  animation: toast-in .3s ease-out;
}
.date-toast[hidden] { display: none; }
.date-toast > svg { width: 22px; color: var(--primary); }
.date-toast span { font-size: 12px; line-height: 1.5; }
.date-toast button { width: 28px; height: 28px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 22px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.currency-dialog { width: min(650px, calc(100% - 30px)); max-height: min(760px, calc(100dvh - 30px)); padding: 0; border: 0; border-radius: 22px; color: var(--text); box-shadow: 0 28px 90px rgba(8,40,29,.25); }
.currency-dialog::backdrop { background: rgba(10,34,27,.58); backdrop-filter: blur(3px); }
.dialog-card { display: flex; flex-direction: column; max-height: min(760px, calc(100dvh - 30px)); padding: 28px; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; }
.dialog-header .eyebrow { margin-bottom: 13px; }
.dialog-header h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.close-button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); background: transparent; font-size: 24px; line-height: 1; }
.search-field { position: relative; display: block; margin: 24px 0 16px; }
.search-field svg { position: absolute; left: 15px; top: 50%; width: 19px; transform: translateY(-50%); color: var(--muted); }
.search-field input { width: 100%; height: 50px; padding: 0 15px 0 44px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); }
.currency-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-height: 180px; overflow-y: auto; padding: 3px 5px 3px 0; }
.currency-option { display: flex; align-items: center; gap: 11px; min-height: 52px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.currency-option:has(input:checked) { border-color: var(--primary); background: var(--surface); }
.currency-option input { width: 17px; height: 17px; accent-color: var(--primary); }
.currency-option strong { display: block; font-size: 12px; }
.currency-option small { display: block; max-width: 190px; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dialog-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 20px; margin-top: 18px; border-top: 1px solid var(--border); }
.dialog-footer span { color: var(--muted); font-size: 12px; }
.primary-button { min-width: 120px; color: var(--white); background: var(--primary); }
.primary-button:hover { background: var(--primary-hover); }

@media (max-width: 950px) {
  .page-shell { padding: 0 28px; }
  .hero { grid-template-columns: 1fr; gap: 46px; padding: 62px 0; }
  .date-panel { max-width: 520px; margin-top: 0; }
  .rates-grid { grid-template-columns: repeat(2, 1fr); }
  .converter-section { margin: 0 -28px; padding: 70px 28px; }
  .converter-card { grid-template-columns: 1fr 52px 1fr; }
  .amount-field { grid-column: 1 / -1; }
  footer { margin: 0 -28px; padding: 25px 28px; }
}

@media (max-width: 640px) {
  .page-shell { padding: 0 18px; }
  .site-header { min-height: 78px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-copy small, .back-link { display: none; }
  .hero { padding: 46px 0 52px; }
  h1 { font-size: clamp(43px, 12vw, 58px); letter-spacing: -.06em; }
  .hero-description { margin-top: 24px; font-size: 15px; }
  .date-panel { min-width: 0; padding: 20px; }
  .date-control, .date-control input { min-width: 0; }
  .rates-section { padding: 56px 0 70px; }
  .section-heading { align-items: flex-start; flex-direction: column; margin-bottom: 26px; }
  .section-heading > div:first-child { gap: 13px; }
  .section-actions { width: 100%; align-items: flex-start; flex-direction: column; gap: 12px; }
  .outline-button { width: 100%; }
  .rates-grid { grid-template-columns: 1fr; }
  .rate-card { min-height: 178px; }
  .rate-value { margin-top: 28px; }
  .converter-section { margin: 0 -18px; padding: 58px 18px 64px; border-radius: 22px 22px 0 0; }
  .converter-heading > p { text-align: left; }
  .converter-card { grid-template-columns: 1fr 46px; padding: 20px; }
  .amount-field, .converter-field, .result-block { grid-column: 1 / -1; }
  .swap-button { grid-column: 2; grid-row: 3; width: 46px; height: 46px; margin: -10px 0 -10px auto; transform: rotate(90deg); }
  .swap-button:hover { transform: rotate(270deg); }
  .converter-field:nth-of-type(3) { grid-row: 4; }
  footer { flex-direction: column; margin: 0 -18px; padding: 24px 18px; }
  .date-toast { right: 16px; bottom: 16px; }
  .dialog-card { padding: 22px 18px; }
  .currency-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; }
}
