:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;

  --bg: #020817;
  --panel: #07152f;
  --panel-2: #0a2145;
  --text: #f7f8fa;
  --muted: #aeb8ca;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #d7dde8;
  --blue: #5aa7e1;
  --good: #72d6a0;
  --bad: #f0a5aa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(
      circle at top right,
      rgba(47, 131, 202, 0.18),
      transparent 36rem
    ),
    linear-gradient(180deg, #07152f 0%, #020611 100%);
  color: var(--text);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 221, 232, 0.38);
  border-radius: 50%;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.back-link {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  text-decoration: none;
}

main {
  padding-block: 70px 80px;
}

.hero {
  max-width: 820px;
  margin-bottom: 44px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -0.025em;
}

.lead {
  max-width: 730px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.archive-panel,
.records-panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(7, 21, 47, 0.88);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.archive-range,
.status-message {
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.controls {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--bg);
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(90, 167, 225, 0.16);
}

.period-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.period-navigation button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.period-navigation button:hover {
  background: rgba(90, 167, 225, 0.09);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin-block: 18px;
}

.summary-grid article {
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 17px;
  background: rgba(10, 33, 69, 0.68);
}

.summary-grid span,
.summary-grid strong {
  display: block;
}

.summary-grid span {
  margin-bottom: 13px;
  color: #8fa0b8;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-grid strong {
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  line-height: 1.35;
}

.missing-message {
  margin: -4px 0 20px;
  padding: 13px 15px;
  border: 1px solid rgba(242, 198, 109, 0.2);
  border-radius: 12px;
  background: rgba(242, 198, 109, 0.07);
  color: #d8c49e;
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

th {
  color: #8fa0b8;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--text);
}

tbody tr {
  cursor: help;
  outline: none;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover,
tbody tr:focus {
  background: rgba(90, 167, 225, 0.09);
}

.rate-value {
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.change-positive {
  color: var(--good);
}

.change-negative {
  color: var(--bad);
}

.change-neutral {
  color: var(--muted);
}

.change-value {
  display: block;
  font-variant-numeric: tabular-nums;
}

.change-percent {
  display: block;
  margin-top: 2px;
  color: inherit;
  font-size: 0.76rem;
  opacity: 0.82;
}

.empty-row {
  padding-block: 34px;
  color: var(--muted);
  text-align: center;
}

.rate-detail {
  position: fixed;
  z-index: 1000;
  width: min(410px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 19px;
  border: 1px solid rgba(90, 167, 225, 0.32);
  border-radius: 18px;
  background:
    linear-gradient(
      145deg,
      rgba(7, 21, 47, 0.98),
      rgba(2, 8, 23, 0.99)
    );
  box-shadow:
    0 24px 75px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.detail-time {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-rate {
  margin-bottom: 15px;
  font-size: 1.28rem;
  line-height: 1.25;
}

.detail-chart {
  display: block;
  width: 100%;
  height: 126px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 8, 23, 0.7);
}

.detail-chart-range {
  margin: 7px 0 15px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.detail-currencies {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.detail-currency {
  min-width: 0;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: center;
}

.detail-currency span,
.detail-currency strong {
  display: block;
}

.detail-currency span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}

.detail-currency strong {
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
}

.detail-statistics {
  display: grid;
  gap: 8px;
  margin: 0;
}

.detail-statistics div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.detail-statistics dt {
  color: var(--muted);
}

.detail-statistics dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.detail-times {
  margin-top: 13px;
  padding-top: 2px;
}

.detail-times p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
  font-size: 0.76rem;
}

.detail-times span {
  color: var(--muted);
}

.detail-times strong {
  text-align: right;
}

footer {
  padding-block: 24px 40px;
  border-top: 1px solid var(--line);
  color: #7f8da3;
  font-size: 0.88rem;
}

footer p {
  margin-bottom: 0;
}

@media (max-width: 850px) {
  .controls,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .archive-range,
  .status-message {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .site-header {
    min-height: 72px;
  }

  .brand small {
    display: none;
  }

  main {
    padding-top: 46px;
  }

  .controls,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .archive-panel,
  .records-panel {
    padding: 18px;
    border-radius: 17px;
  }

  .period-navigation button {
    flex: 1 1 calc(50% - 10px);
  }

  .rate-detail {
    right: 12px !important;
    bottom: 12px !important;
    left: 12px !important;
    top: auto !important;
    width: auto;
    max-height: 70vh;
  }
}


/* =========================================================
   VIRELIA_MOBILE_TOUCH_TARGETS_V1
   ========================================================= */

@media (max-width: 760px) {
  .brand,
  .back-link {
    min-height: 44px;

    box-sizing: border-box;
  }

  .back-link {
    display: inline-flex;

    align-items: center;
    justify-content: center;
  }

  .period-navigation button {
    min-width: 44px;
    min-height: 44px;

    box-sizing: border-box;
  }
}
