* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  transition: background-color .2s ease, color .2s ease;
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  z-index: 20;
  top: -50px;
  left: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.skip-link:focus { top: 10px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  height: 76px;
  align-items: center;
  gap: 34px;
  padding: 0 max(28px, calc((100vw - 1240px) / 2));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 10px; color: var(--text); font-size: 17px; font-weight: 720; letter-spacing: -.035em; }
.brand img { display: block; border-radius: 11px; }
.primary-nav { display: flex; align-items: center; gap: 5px; margin: auto; }
.primary-nav a, .site-footer a:not(.brand) {
  padding: 8px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
  border-radius: 8px;
  transition: color .16s ease, background .16s ease;
}
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.language-switch {
  min-width: 39px;
  height: 36px;
  padding: 0 7px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.language-switch:hover { background: var(--surface-muted); color: var(--text); }
.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-muted); border-color: var(--line); }
.icon-button svg, .button svg, .search-field svg, .source-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.menu-toggle { display: none; }

.page-shell { width: min(1240px, calc(100% - 56px)); min-height: calc(100vh - 180px); margin: 0 auto; padding: 42px 0 72px; }
.page-view { animation: appear .24s ease both; }
@keyframes appear { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero {
  display: flex;
  min-height: 280px;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 42px 48px;
  overflow: hidden;
  background: linear-gradient(115deg, var(--surface), color-mix(in srgb, var(--accent-soft) 46%, var(--surface)));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.hero-copy { max-width: 670px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(32px, 4vw, 48px); line-height: 1.08; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: 22px; line-height: 1.25; letter-spacing: -.035em; }
.hero-description { max-width: 575px; margin-bottom: 22px; color: var(--muted); font-size: 16px; }
.hero-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 4px color-mix(in srgb, var(--positive) 14%, transparent); }
.hero-actions { display: grid; flex: 0 0 auto; gap: 15px; }
.date-card { min-width: 205px; padding: 15px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.date-card span, .date-card small { display: block; color: var(--muted); font-size: 11px; }
.date-card strong { display: block; padding: 4px 0; font-size: 17px; }
.button {
  display: inline-flex;
  min-height: 41px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-hover); color: #fff; }
:root[data-theme="dark"] .button-primary { color: #10203a; }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.button-secondary:hover { border-color: var(--accent); }

.content-block { margin-top: 52px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.section-heading.compact { margin-bottom: 20px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.text-link { font-size: 12px; font-weight: 690; white-space: nowrap; }
.currency-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.currency-card, .panel, .skeleton-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.currency-card { position: relative; min-height: 156px; padding: 17px 18px; transition: transform .18s ease, box-shadow .18s ease; }
.currency-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.currency-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.currency-card-top .currency-code, .currency-code { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.currency-symbol { display: inline-grid; width: 34px; height: 34px; place-items: center; margin-right: 8px; background: var(--accent-soft); border-radius: 10px; color: var(--accent); font-size: 17px; font-weight: 700; }
.currency-name { display: block; margin-top: 12px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.currency-value { display: block; margin-top: 2px; font-size: 21px; font-weight: 720; letter-spacing: -.035em; }
.currency-change { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 650; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.favorite-button { display: inline-grid; width: 32px; height: 32px; place-items: center; padding: 0; background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--muted); cursor: pointer; }
.favorite-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.favorite-button:hover { background: var(--surface-muted); border-color: var(--line); color: var(--accent); }
.favorite-button.is-favorite { color: #e0a526; }
.favorite-button.is-favorite svg { fill: currentColor; }
.skeleton-card { min-height: 156px; background: linear-gradient(100deg, var(--surface) 30%, var(--surface-muted) 50%, var(--surface) 70%); background-size: 250% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -150% 0; } }

.panel { padding: 24px; box-shadow: 0 4px 16px rgb(22 40 72 / 2%); }
.mini-chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mini-chart { min-width: 0; padding: 18px 18px 12px; }
.chart-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chart-title strong { font-size: 13px; }
.chart-title h2 { font-size: 18px; }
.muted { color: var(--muted); font-size: 11px; }
.chart-canvas { position: relative; width: 100%; height: 145px; margin-top: 12px; }
.large-chart { height: 340px; margin: 24px 0; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 16px; }
.quick-converter { min-width: 0; }
.source-panel { display: flex; flex-direction: column; align-items: flex-start; }
.source-panel h2 { max-width: 280px; margin-bottom: 12px; }
.source-panel p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.source-icon { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 20px; background: var(--accent-soft); border-radius: 13px; color: var(--accent); }
.source-icon svg { width: 24px; height: 24px; }

.page-heading { margin: 9px 0 28px; }
.page-heading h1 { margin-bottom: 9px; font-size: clamp(34px, 4vw, 44px); }
.page-heading > p:last-child { max-width: 720px; margin-bottom: 0; color: var(--muted); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 11px; margin-bottom: 20px; }
.search-field { position: relative; display: flex; min-width: 230px; flex: 1 1 250px; align-items: center; }
.search-field svg { position: absolute; left: 12px; width: 17px; color: var(--muted); }
.search-field input { padding-left: 38px; }
.select-field { display: grid; gap: 5px; min-width: 142px; color: var(--muted); font-size: 11px; }
input, select {
  min-width: 0;
  min-height: 41px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
}
input::placeholder { color: var(--muted); opacity: .75; }
.check-control { display: inline-flex; align-items: center; gap: 7px; padding: 10px 2px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check-control input { min-height: 0; accent-color: var(--accent); }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-muted); color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
td { font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 33%, var(--surface)); }
.currency-cell { display: flex; min-width: 190px; align-items: center; gap: 10px; }
.currency-cell .currency-symbol { flex: 0 0 auto; width: 32px; height: 32px; margin: 0; font-size: 14px; }
.currency-cell strong, .currency-cell small { display: block; }
.currency-cell small { max-width: 250px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.table-message { padding: 30px; color: var(--muted); text-align: center; }
.table-footnote { margin: 13px 2px 0; color: var(--muted); font-size: 11px; }

.converter-panel { max-width: 900px; margin: 0 auto; padding: clamp(24px, 5vw, 50px); }
.converter-form { display: grid; align-items: end; gap: 12px; }
.converter-form label, .history-controls label { display: grid; min-width: 0; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 650; }
.full-form { grid-template-columns: minmax(150px, 1fr) minmax(110px, .8fr) 44px minmax(110px, .8fr); align-items: end; }
.compact-form { grid-template-columns: 1fr 1fr 36px 1fr; }
.swap-button { display: inline-grid; width: 42px; height: 42px; place-items: center; padding: 0; background: var(--accent-soft); border: 0; border-radius: 12px; color: var(--accent); cursor: pointer; font-size: 20px; }
.swap-button:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent)); }
.conversion-result { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-top: 26px; padding: 20px; background: var(--surface-muted); border-radius: 13px; }
.conversion-result > span { color: var(--muted); font-size: 12px; }
.conversion-result strong { margin-left: auto; font-size: 27px; letter-spacing: -.04em; }
.conversion-result small { flex: 1 0 100%; }
.quick-pairs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 17px; color: var(--muted); font-size: 11px; }
.quick-pairs button, .period-chips button { padding: 7px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--text); cursor: pointer; font-size: 11px; }
.quick-pairs button:hover, .period-chips button:hover { border-color: var(--accent); color: var(--accent); }
.warning-note { margin: 24px 0 0; padding: 12px 14px; background: var(--warning-bg); border-radius: 9px; color: var(--warning-text); font-size: 11px; }
.compact-form input { width: 100%; }
.quick-converter .conversion-result { margin-top: 16px; padding: 14px; }
.quick-converter .conversion-result strong { font-size: 21px; }

.history-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.history-controls label { flex: 1 1 145px; }
.history-controls label select[multiple] { min-height: 100px; }
.period-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.inline-status { min-height: 18px; margin: 15px 0 0; color: var(--muted); font-size: 12px; }
.inline-status.status-error { color: var(--negative); }
.inline-retry { padding: 0; background: transparent; border: 0; cursor: pointer; }
.table-wrap + .table-wrap { margin-top: 18px; }
.analytics-controls { align-items: start; }
.analytics-controls label:first-child { flex-basis: 210px; }
.analytics-controls label select[multiple] { height: 120px; }

.notice { margin-bottom: 18px; padding: 13px 16px; border-radius: 10px; font-size: 12px; }
.notice-error { background: color-mix(in srgb, var(--negative) 12%, var(--surface)); color: var(--negative); }
.economy-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.key-rate-value { display: block; font-size: 48px; letter-spacing: -.05em; }
.economy-panel .eyebrow { margin-bottom: 0; }
.economy-panel p { margin-bottom: 0; }
.favorite-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.favorite-row { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface-muted); border-radius: 12px; }
.favorite-row .currency-symbol { flex: 0 0 auto; margin: 0; }
.favorite-row-main { flex: 1; min-width: 0; }
.favorite-row-main strong, .favorite-row-main small { display: block; }
.favorite-row-main small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.favorite-actions { display: flex; align-items: center; gap: 4px; }
.favorite-actions button { padding: 7px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: var(--text); cursor: pointer; font-size: 11px; }
.about-panel { max-width: 850px; }
.about-panel p { max-width: 760px; color: var(--muted); font-size: 14px; }
.about-panel h2 { margin-bottom: 14px; }
.settings-panel { max-width: 800px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.setting-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.settings-panel > .muted { display: block; margin: 18px 0 0; }

.site-footer {
  display: flex;
  min-height: 90px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px max(28px, calc((100vw - 1240px) / 2));
  border-top: 1px solid var(--line);
}
.site-footer > span { color: var(--muted); font-size: 10px; }
.site-footer > div { display: flex; gap: 4px; }
.footer-brand { font-size: 14px; }
.footer-brand img { border-radius: 8px; }
