﻿:root {
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

body[data-theme="dark"] {
  --bg: #07110d;
  --bg-secondary: #0d1712;
  --surface: rgba(11, 22, 18, 0.86);
  --surface-strong: rgba(15, 30, 24, 0.96);
  --surface-soft: rgba(17, 35, 28, 0.88);
  --text: #e9f4ee;
  --muted: #9eb7ab;
  --line: rgba(124, 182, 149, 0.16);
  --primary: #39c07f;
  --accent: #8ef0ba;
  --success: #63d597;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
  --table-hover: rgba(57, 192, 127, 0.08);
  --grid-line: rgba(181, 232, 204, 0.14);
  --chart-fill-start: rgba(57, 192, 127, 0.28);
  --chart-fill-end: rgba(57, 192, 127, 0.02);
}

body[data-theme="light"] {
  --bg: #f5fbf7;
  --bg-secondary: #ebf5ef;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-soft: rgba(242, 249, 245, 0.95);
  --text: #102118;
  --muted: #587264;
  --line: rgba(32, 91, 63, 0.12);
  --primary: #177d4f;
  --accent: #20aa69;
  --success: #177d4f;
  --shadow: 0 24px 60px rgba(27, 72, 48, 0.12);
  --table-hover: rgba(23, 125, 79, 0.07);
  --grid-line: rgba(16, 99, 62, 0.12);
  --chart-fill-start: rgba(23, 125, 79, 0.22);
  --chart-fill-end: rgba(23, 125, 79, 0.02);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(57, 192, 127, 0.12), transparent 22rem),
    radial-gradient(circle at right 18%, rgba(142, 240, 186, 0.1), transparent 30rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-secondary) 100%);
  transition: background 180ms ease, color 180ms ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  filter: blur(2px);
}

body::before {
  top: 3rem;
  right: 4rem;
  width: 16rem;
  height: 16rem;
  border-radius: 50%;
  background: rgba(57, 192, 127, 0.09);
}

body::after {
  bottom: 6rem;
  left: 3rem;
  width: 20rem;
  height: 20rem;
  border-radius: 38% 62% 48% 52% / 54% 40% 60% 46%;
  background: rgba(142, 240, 186, 0.06);
}

.app {
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero > *,
.dashboard-grid > *,
.site-footer__grid > *,
.converter__row > *,
.chart-controls > *,
.chart-controls__dates > * {
  min-width: 0;
}

.hero,
.panel,
.site-footer {
  backdrop-filter: blur(20px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 360px);
  gap: 1.5rem;
  padding: 2rem;
  border-radius: var(--radius-xl);
}

.eyebrow,
.panel__eyebrow {
  margin: 0 0 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--primary);
}

.hero__topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.hero h1,
.panel h2,
.footer-card h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.hero h1 {
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.hero__lead {
  max-width: 50ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.hero__context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: baseline;
  margin-top: 1.15rem;
  color: var(--muted);
  line-height: 1.7;
}

.hero__context strong {
  color: var(--text);
  font-size: 0.98rem;
}

.rate-card,
.chart-summary > div,
.footer-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.site-footer__text,
.rate-card__name,
.rate-card__scale,
.helper-text,
.search input::placeholder {
  color: var(--muted);
}

.hero__panel {
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(8, 20, 15, 0.98), rgba(13, 31, 24, 0.96));
  color: #eef9f2;
  border: 1px solid rgba(142, 240, 186, 0.12);
}

body[data-theme="light"] .hero__panel {
  background: linear-gradient(180deg, #133b28, #0f2e20);
}

.hero__panel-header h2 {
  font-size: 1.25rem;
  margin-top: 0.15rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.dashboard-grid--bottom {
  align-items: start;
  grid-template-columns: 1fr;
}

.panel {
  padding: 1.5rem;
  border-radius: var(--radius-xl);
}

.panel--chart {
  order: -1;
}

.panel--spotlight {
  background:
    linear-gradient(135deg, var(--surface-strong), var(--surface)),
    radial-gradient(circle at top right, rgba(57, 192, 127, 0.12), transparent 12rem);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.featured-rates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.rate-card {
  padding: 1rem;
}

.rate-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.rate-card__code {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.rate-card__value {
  margin: 0.65rem 0 0.3rem;
  font-size: 1.75rem;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
.button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(57, 192, 127, 0.45);
  box-shadow: 0 0 0 4px rgba(57, 192, 127, 0.08);
}

.hero__panel input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #eef9f2;
}

.button {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.button:hover,
.footer-link:hover {
  transform: translateY(-1px);
}

.button--primary {
  padding: 0.95rem 1.2rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #04120b;
  font-weight: 800;
}

.button--ghost {
  background: rgba(57, 192, 127, 0.08);
  color: var(--primary);
}

.button--icon {
  width: 3.25rem;
  min-width: 3.25rem;
  align-self: end;
  height: 3.25rem;
}

.converter {
  display: grid;
  gap: 1rem;
}

.converter__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: end;
}

.converter__result {
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-soft));
  border: 1px solid var(--line);
}

.converter__result span {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.78rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-strong);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  font-size: 0.95rem;
}

tbody tr:hover {
  background: var(--table-hover);
}

.status-pill {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(45, 127, 94, 0.12);
  color: var(--success);
  font-size: 0.88rem;
  font-weight: 700;
}

.search {
  min-width: min(100%, 17rem);
}

.chart-controls,
.chart-controls__dates,
.chart-summary,
.site-footer__grid {
  display: grid;
  gap: 1rem;
}

.chart-controls__dates,
.site-footer__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0 1.2rem;
}

.chart-summary > div,
.footer-card {
  padding: 1rem;
}

.chart-summary span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.chart-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: linear-gradient(180deg, var(--surface-soft), var(--surface-strong));
  border: 1px solid var(--line);
  overflow: hidden;
}

#chartSvg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 820 / 340;
  touch-action: none;
  user-select: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 9rem;
  max-width: 14rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 17, 13, 0.92);
  color: #eef9f2;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
}

body[data-theme="light"] .chart-tooltip {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

@media (max-width: 1100px) {
  .app {
    width: min(100%, calc(100% - 1.5rem));
    padding: 1.5rem 0 3rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
    align-items: end;
  }
}

@media (max-width: 820px) {
  .app {
    width: min(100%, calc(100% - 1rem));
    padding: 1rem 0 2rem;
  }

  .hero,
  .panel,
  .site-footer {
    border-radius: 22px;
  }

  .hero,
  .panel {
    padding: 1.25rem;
  }

  .hero__topbar,
  .panel__head {
    flex-direction: column;
    align-items: stretch;
  }

  .theme-switch {
    align-self: flex-start;
  }

  .featured-rates,
  .chart-controls,
  .chart-controls__dates,
  .chart-summary,
  .site-footer__grid {
    grid-template-columns: 1fr;
  }

  .converter__row {
    grid-template-columns: 1fr;
  }

  .button--icon {
    width: 100%;
    min-width: 0;
    height: 3rem;
  }

  .search {
    min-width: 0;
  }

  .chart-card {
    padding: 0.65rem;
  }

  #chartSvg {
    min-width: 1120px;
    aspect-ratio: 1120 / 520;
  }

  .chart-tooltip {
    min-width: 8rem;
    max-width: 12rem;
    padding: 0.6rem 0.7rem;
  }
}

@media (max-width: 560px) {
  body::before {
    top: 1rem;
    right: 1rem;
    width: 10rem;
    height: 10rem;
  }

  body::after {
    bottom: 3rem;
    left: 0.5rem;
    width: 12rem;
    height: 12rem;
  }

  .app {
    width: min(100%, calc(100% - 0.75rem));
    padding: 0.75rem 0 1.5rem;
  }

  .hero,
  .panel {
    padding: 1rem;
  }

  .hero {
    gap: 1rem;
  }

  .hero h1 {
    font-size: clamp(1.9rem, 10vw, 2.5rem);
    line-height: 0.96;
  }

  .hero__lead,
  .hero__context,
  .helper-text,
  td {
    font-size: 0.92rem;
  }

  .hero__panel {
    padding: 1rem;
  }

  .hero__panel-header h2,
  .panel h2 {
    font-size: 1.1rem;
  }

  .theme-switch {
    width: 100%;
    justify-content: center;
  }

  .theme-switch__label {
    font-size: 0.82rem;
  }

  input,
  select,
  .button {
    min-height: 3rem;
  }

  .converter__result {
    padding: 1rem;
  }

  .converter__result output {
    display: block;
    font-size: clamp(1.55rem, 8vw, 2.1rem);
    line-height: 1.08;
    word-break: break-word;
  }

  .rate-card__value {
    font-size: 1.45rem;
  }

  .chart-summary > div,
  .footer-card {
    padding: 0.9rem;
  }

  .chart-card {
    padding: 0.35rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #chartSvg {
    min-width: 1120px;
    aspect-ratio: 1120 / 520;
  }

  th,
  td {
    padding: 0.72rem 0.72rem;
  }

  th {
    font-size: 0.72rem;
  }

  .site-footer__grid {
    gap: 0.75rem;
  }
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.98rem;
}

.chart-tooltip span {
  color: var(--muted);
  font-size: 0.82rem;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.theme-switch:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(57, 192, 127, 0.12);
}

.theme-switch__label {
  white-space: nowrap;
}

.theme-switch__track {
  position: relative;
  width: 3rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(57, 192, 127, 0.18);
  border: 1px solid rgba(57, 192, 127, 0.24);
}

.theme-switch__thumb {
  position: absolute;
  top: 0.16rem;
  left: 0.18rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--surface-strong);
  transition: transform 160ms ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.theme-switch[aria-checked="true"] .theme-switch__thumb {
  transform: translateX(1.25rem);
}

.site-footer {
  margin-top: 1.5rem;
  padding: 1.2rem;
  border-radius: var(--radius-xl);
}

.site-footer__grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.footer-card h3 {
  margin-bottom: 0.7rem;
  font-size: 1.2rem;
  line-height: 1.2;
}

.site-footer__text {
  margin: 0 0 1rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.footer-link:hover {
  border-color: rgba(57, 192, 127, 0.35);
  background: rgba(57, 192, 127, 0.08);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 1rem;
  }

  .footer-card {
    padding: 1rem;
  }

  .footer-link {
    width: 100%;
    text-align: center;
  }

  .theme-switch {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 0.45rem;
  }
}

@media (max-width: 560px) {
  .site-footer {
    padding: 0.9rem;
  }

  .site-footer__grid {
    gap: 0.7rem;
  }

  .footer-card {
    padding: 0.9rem;
    border-radius: 14px;
  }

  .footer-card h3 {
    font-size: 1.02rem;
    margin-bottom: 0.55rem;
  }

  .site-footer__text {
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 0.8rem;
  }

  .footer-link {
    min-height: 2.9rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
  }

  .theme-switch {
    gap: 0.5rem;
    padding: 0.7rem 0.75rem;
  }

  .theme-switch__label {
    white-space: normal;
    text-align: center;
    line-height: 1.15;
  }

  .theme-switch__track {
    order: -1;
  }

  .panel__head {
    margin-bottom: 1rem;
  }

  .search input {
    min-width: 0;
  }
}
