:root {
  color-scheme: light;
  --ink: #162d3a;
  --muted: #586a77;
  --green: #087f65;
  --blue: #2864d9;
  --border: #dfe6ed;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f3f6f9; font-size: 1rem; line-height: 1.5; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #477cec; outline-offset: 4px; }
[hidden] { display: none !important; }
.topbar { background: #122c3a; color: #fff; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 18px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 1rem; font-weight: 750; letter-spacing: .04em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; flex: none; width: 35px; height: 35px; border-radius: 10px; }
.timezone { font-size: .875rem; color: #d1dce3; }
main { max-width: 1180px; margin: 0 auto; padding: 32px 32px 24px; }
.purchase-brief { margin-bottom: 32px; }
.purchase-brief > h2 { margin-bottom: 14px; font-size: 1.35rem; }
.brief-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.brief-card { min-width: 0; padding: 20px 24px; border: 1px solid; border-radius: 16px; }
.brief-dollar { background: #e9f6f1; border-color: #c9e7db; }
.brief-gold { background: #fff8e9; border-color: #ecdcbb; }
.brief-card h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 650; }
.brief-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.brief-price strong { font-size: clamp(1.75rem, 3vw, 2.4rem); line-height: 1.3; letter-spacing: -.035em; }
.brief-price > span, .brief-detail, .brief-meta { color: var(--muted); font-size: .875rem; }
.brief-detail { margin: 4px 0 8px; }
.brief-meta { margin: 0; }
.brief-link { display: inline-block; margin-top: 8px; font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { font-size: .875rem; font-weight: 700; letter-spacing: .12em; color: var(--green); margin: 0 0 6px; }
h1 { font-size: clamp(1.65rem, 3vw, 2.1rem); line-height: 1.25; letter-spacing: -.025em; margin: 0; font-weight: 720; }
.description { margin: 8px 0 0; color: var(--muted); }
.update-status { flex-shrink: 0; font-size: .875rem; color: var(--muted); padding-bottom: 3px; }
.update-status.warning { color: #975413; }
.rate-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.rate-summary { padding: 20px 24px 17px; border-radius: 16px; border: 1px solid; }
.rate-summary.kyiv { background: #e9f6f1; border-color: #c9e7db; }
.rate-summary.vyshgorod { background: #edf3fe; border-color: #d4e1f8; }
.rate-city { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.rate-quotes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; }
.rate-label { color: var(--muted); font-size: .875rem; }
.quote-explanation { color: var(--muted); font-size: .875rem; margin: -10px 0 22px; }
.series-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--green); }
.vyshgorod .series-dot, .vyshgorod-dot { background: var(--blue); }
.rate-value { margin: 5px 0 5px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.rate-value > span:first-child { font-size: 2.5rem; font-weight: 720; letter-spacing: -.045em; line-height: 1.3; }
.rate-unit { color: var(--muted); font-size: .875rem; }
.rate-meta { display: flex; gap: 10px; justify-content: space-between; color: var(--muted); font-size: .875rem; }
.rate-meta a { text-decoration: underline; text-underline-offset: 3px; }
.chart-card { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 24px 28px 18px; box-shadow: 0 5px 20px #223b5710; }
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; margin: 0; font-weight: 650; }
.rate-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 20px; }
.rate-selection > span { font-size: .875rem; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; max-width: 100%; gap: 4px; padding: 4px; background: #f1f4f7; border-radius: 10px; }
.presets button { color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 7px 12px; font-size: .875rem; white-space: nowrap; }
.presets button[aria-pressed="true"] { color: var(--ink); background: #fff; box-shadow: 0 1px 4px #18304418; font-weight: 600; }
.presets button:hover { color: var(--ink); }
.period-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.period-form label { display: flex; flex-direction: column; gap: 6px; font-size: .875rem; font-weight: 600; }
.period-form input { min-width: 0; width: 100%; border: 1px solid #cfd9e2; color: var(--ink); background: #fff; border-radius: 9px; min-height: 46px; padding: 9px 12px; font-size: 1rem; }
.period-form input:hover { border-color: #98acbb; }
.period-form button { min-height: 46px; border: 1px solid var(--ink); color: #fff; background: var(--ink); border-radius: 9px; padding: 10px 25px; font-weight: 600; }
.period-form button:hover { background: #254958; }
.period-form button:disabled { opacity: .6; cursor: wait; }
.chart-information { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; font-size: .875rem; color: var(--muted); margin: 10px 0 16px; }
.error-message { color: #9c3329; background: #fff0ed; border: 1px solid #f2cdc7; padding: 10px 14px; border-radius: 9px; font-size: .875rem; }
.chart-shell { position: relative; width: 100%; height: clamp(330px, 44vh, 450px); }
#rate-chart { width: 100%; height: 100%; display: block; overflow: visible; touch-action: pan-y; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--muted); pointer-events: none; }
.chart-tooltip { position: absolute; z-index: 2; width: 215px; padding: 13px 15px; border-radius: 10px; background: #fff; border: 1px solid var(--border); box-shadow: 0 6px 24px #17364b24; pointer-events: none; font-size: .875rem; }
.tooltip-time { color: var(--muted); margin-bottom: 9px; }
.tooltip-side { color: var(--muted); font-size: .8rem; }
.history-notice { color: var(--muted); font-size: .875rem; margin: 12px 0 0; }
.tooltip-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; }
.tooltip-row > span { display: flex; align-items: center; gap: 7px; }
.tooltip-row strong { font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-footer { border-top: 1px solid #edf0f4; margin-top: 12px; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .875rem; color: var(--muted); }
.legend { display: flex; gap: 22px; color: var(--ink); }
.legend > span { display: flex; align-items: center; gap: 8px; }
.legend-line { display: inline-block; width: 22px; height: 3px; border-radius: 2px; }
.kyiv-line { background: var(--green); }
.vyshgorod-line { background: var(--blue); }
.page-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding-top: 18px; color: var(--muted); font-size: .875rem; }
.chart-grid { stroke: #e8edf2; stroke-width: 1; }
.chart-axis-label { fill: #586a77; font-family: inherit; font-size: 14px; font-variant-numeric: tabular-nums; }
.chart-series { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-crosshair { stroke: #aab9c6; stroke-width: 1; stroke-dasharray: 4 4; }
.gold-monitor { margin-top: 42px; scroll-margin-top: 20px; }
.gold-monitor #gold-heading { font-size: clamp(1.45rem, 3vw, 1.8rem); }
.gold-eyebrow { color: #946516; }
.gold-summary { background: #fff8e9; border-color: #ecdcbb; margin-bottom: 20px; }
.gold-summary-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; }
.gold-details { display: flex; flex-direction: column; gap: 4px; font-size: .875rem; color: var(--muted); }
.gold-details a { text-decoration: underline; text-underline-offset: 3px; }
.gold-ounce-equivalent { display: inline-block; max-width: 100%; color: var(--muted); font-size: .875rem; font-weight: 400; }
.gold-chart-shell { height: 300px; }
.gold-comparison { margin-bottom: 20px; }
.gold-conversion-hint { font-size: .875rem; margin: 12px 0 18px; }
.gold-offers-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .875rem; }
.gold-offers-table th, .gold-offers-table td { text-align: left; vertical-align: top; padding: 14px 10px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.gold-offers-table th:first-child, .gold-offers-table td:first-child { padding-left: 0; }
.gold-offers-table th:last-child, .gold-offers-table td:last-child { padding-right: 0; }
.gold-offers-table thead { color: var(--muted); font-size: .8rem; }
.gold-offers-table thead th:nth-child(3) { width: 34%; }
.gold-offers-table a { text-decoration: underline; text-underline-offset: 3px; }
.gold-offers-table strong { display: block; font-variant-numeric: tabular-nums; font-weight: 650; }
.gold-offers-table small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.5; font-size: .8rem; font-weight: 400; }
.gold-series-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.gold-series-controls button { display: flex; align-items: center; gap: 8px; border: 1px solid #cfd9e2; border-radius: 9px; padding: 9px 12px; background: #fff; color: var(--ink); font-size: .875rem; }
.gold-series-controls button[aria-pressed="false"] { color: var(--muted); background: #f1f4f7; }
.gold-series-controls button[aria-pressed="false"] .legend-line { opacity: .3; }
.gold24-line { background: #a46f12; }
.privatbank-line { background: #39708c; }
.xau-line { background: #8757bd; }
#gold-tooltip { width: 250px; max-width: calc(100% - 8px); }
#gold-tooltip .tooltip-row { flex-wrap: wrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 650px) {
  .topbar-inner { padding: 15px 18px; gap: 12px; }
  .brand { gap: 8px; font-size: .875rem; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .timezone { font-size: .875rem; }
  main { padding: 24px 16px 20px; }
  .purchase-brief { margin-bottom: 26px; }
  .brief-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .brief-card { padding: 16px 18px; border-radius: 12px; }
  .page-heading { display: block; margin-bottom: 18px; }
  .update-status { margin-top: 12px; }
  .rate-overview { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 10px; margin-bottom: 18px; }
  .rate-quotes { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .rate-summary { padding: 15px 14px; border-radius: 12px; }
  .rate-value > span:first-child { font-size: 2rem; }
  .rate-value { gap: 6px; }
  .rate-meta { display: block; }
  .rate-meta a { display: block; margin-top: 4px; }
  .chart-card { padding: 19px 14px 16px; border-radius: 16px; }
  .chart-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .presets { align-self: stretch; }
  .presets button { flex: 1 1 auto; padding: 8px; }
  .period-form { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .period-form button { width: 100%; }
  .period-form input { min-height: 47px; }
  .chart-information { margin-bottom: 12px; }
  .chart-shell { height: 340px; }
  .chart-footer { gap: 12px; }
  .page-footer { flex-direction: column; gap: 4px; }
  .gold-offers-table thead { display: none; }
  .gold-offers-table, .gold-offers-table tbody { display: block; }
  .gold-offers-table tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
  .gold-offers-table th, .gold-offers-table td { display: block; border: 0; padding: 0; }
  .gold-offers-table th, .gold-offers-table td:last-child { grid-column: 1 / -1; }
  .gold-offers-table td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
