@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --navy: #102a43;
    --blue: #1667c7;
    --blue-soft: #eaf3ff;
    --green: #14866d;
    --green-soft: #e7f6f0;
    --orange: #d76b2d;
    --orange-soft: #fff1e8;
    --ink: #183247;
    --muted: #668096;
    --line: #dce7f0;
    --paper: #f5f8fb;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: 'DM Sans', sans-serif;
}

body::before {
    position: fixed;
    inset: 0 0 auto;
    z-index: -1;
    height: 330px;
    content: '';
    background: linear-gradient(135deg, #dcecff 0%, #f5f8fb 72%);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 8px 0;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
}

.site-nav {
    display: flex;
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--navy);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.site-logo img { width: 48px; height: 48px; object-fit: contain; }
.site-nav ul { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; margin: 0; padding: 0; list-style: none; }
.site-nav a:not(.site-logo) { color: var(--ink); font-size: .84rem; font-weight: 600; text-decoration: none; }
.site-nav a:not(.site-logo):hover { color: var(--blue); }

.rates-page {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
    padding: 72px 0 40px;
}

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

.eyebrow {
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    color: var(--navy);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.intro {
    max-width: 470px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.refresh-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid var(--navy);
    border-radius: 7px;
    color: var(--white);
    background: var(--navy);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.refresh-button:hover:not(:disabled) {
    background: var(--blue);
    transform: translateY(-2px);
}

.refresh-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.refresh-icon {
    display: inline-block;
    font-size: 1.3rem;
    line-height: 1;
}

.is-loading .refresh-icon {
    animation: spin 0.8s linear infinite;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--muted);
}

.status-dot--loading { background: var(--orange); }
.status-dot--success { background: var(--green); }
.status-dot--error { background: #c83c45; }

.last-update {
    margin-left: auto;
    text-align: right;
}

.rates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.rate-card {
    position: relative;
    min-height: 305px;
    overflow: hidden;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 12px 30px rgba(16, 42, 67, 0.07);
    animation: rise 0.5s ease both;
}

.rate-card:nth-child(2) { animation-delay: 0.08s; }
.rate-card:nth-child(3) { animation-delay: 0.16s; }

.rate-card::after {
    position: absolute;
    right: -34px;
    bottom: -45px;
    width: 135px;
    height: 135px;
    border-radius: 50%;
    content: '';
    opacity: 0.75;
}

.rate-card--official::after { background: var(--blue-soft); }
.rate-card--parallel::after { background: var(--orange-soft); }

.card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.source-logo {
    display: block;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50%;
    object-fit: contain;
}

.source-tag {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.currency-name {
    margin: 26px 0 2px;
    font-size: 1.05rem;
    font-weight: 600;
}

.currency-code {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.rate-value {
    position: relative;
    z-index: 1;
    margin: 18px 0 0;
    color: var(--navy);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.rate-label {
    position: relative;
    z-index: 1;
    margin: 2px 0 22px;
    color: var(--muted);
    font-size: 0.82rem;
}

.card-date {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.rates-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.78rem;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
    .site-nav { align-items: flex-start; flex-direction: column; gap: 8px; }
    .site-nav ul { justify-content: flex-start; gap: 10px 14px; }
    .rates-page { padding-top: 42px; }
    .rates-header { align-items: flex-start; flex-direction: column; }
    .refresh-button { align-self: stretch; justify-content: center; }
    .rates-grid { grid-template-columns: 1fr; }
    .rate-card { min-height: 260px; }
}

@media (max-width: 480px) {
    .rates-page { width: min(100% - 28px, 1100px); }
    .status-bar { align-items: flex-start; flex-wrap: wrap; }
    .last-update { flex-basis: 100%; margin-left: 18px; text-align: left; }
    .rates-footer { flex-direction: column; gap: 5px; }
}