:root {
  --maxw: 1000px;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="light"] {
  --bg: #eef2f7; --card: #ffffff; --text: #0f172a; --muted: #64748b;
  --border: #e4e9f0; --row-hover: #f6f8fb; --best-bg: #ecfdf5; --best-border: #86efac;
  --accent: #15803d; --accent-strong: #16a34a;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 16px rgba(15,23,42,.04);
  --chip: #ffffff; --chip-border: #e4e9f0; --field: #f1f5f9;
}
[data-theme="dark"] {
  --bg: #0a0f1c; --card: #121d33; --text: #e8eefb; --muted: #94a6c4;
  --border: #233248; --row-hover: #17243f; --best-bg: #0e2c20; --best-border: #1f7a52;
  --accent: #34d399; --accent-strong: #34d399;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 28px rgba(0,0,0,.35);
  --chip: #ffffff; --chip-border: #cdd7e6; --field: #0e1830;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
  padding: clamp(16px, 4vw, 44px);
  transition: background .25s ease, color .25s ease;
}
.wrap { max-width: var(--maxw); margin: 0 auto; }
a { color: var(--accent-strong); }

/* ---- Top navigation ---- */
.nav {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 22px; border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em;
  text-decoration: none; color: var(--text); margin: 0 auto 0 0;
  display: inline-flex; align-items: center; gap: 9px;
}
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem;
  background: linear-gradient(135deg, var(--accent-strong), #0ea5e9);
}
.brand .bt { line-height: 1.05; }
.brand .bt small { display: block; font-weight: 500; font-size: .68rem; color: var(--muted); letter-spacing: .01em; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 500;
  padding: 6px 10px; border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--row-hover); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--row-hover); }

.theme-toggle {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow);
  transition: transform .15s ease, background .25s ease, border-color .2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--accent-strong); }
.theme-toggle:active { transform: translateY(0); }
.theme-toggle svg { width: 19px; height: 19px; }
[data-theme="dark"] .ico-moon, [data-theme="light"] .ico-sun { display: none; }

/* ---- Page hero ---- */
.hero { margin-bottom: 22px; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.15rem); margin: 0 0 6px; letter-spacing: -.02em; }
.hero h1 .arrow { color: var(--accent-strong); }
.hero .intro { margin: 10px 0 2px; color: var(--muted); font-size: .9rem; line-height: 1.5; max-width: 760px; }
.hero .sub { margin: 8px 0 0; color: var(--muted); font-size: .94rem; }
.hero .sub strong { color: var(--text); }

/* ---- Converter card ---- */
.converter {
  margin-top: 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; max-width: 680px;
}
.conv-currencies { display: flex; align-items: stretch; gap: 10px; }
.conv-currencies .ccy-select { flex: 1 1 0; min-width: 0; }
.swap-btn {
  flex: none; align-self: center; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--field); color: var(--text);
  cursor: pointer; display: grid; place-items: center;
  transition: transform .18s ease, border-color .2s ease, background .2s ease;
}
.swap-btn:hover { border-color: var(--accent-strong); transform: rotate(180deg); }
.swap-btn:disabled { opacity: .35; cursor: not-allowed; }
.swap-btn:disabled:hover { border-color: var(--border); transform: none; }
.swap-btn svg { width: 20px; height: 20px; }

/* searchable currency picker */
.ccy-select { position: relative; }
.ccy-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--field); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; color: var(--text); font: inherit; text-align: left;
}
.ccy-trigger:hover { border-color: var(--accent-strong); }
.ccy-trigger:focus-visible { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.ccy-trigger .t-sym { font-weight: 800; font-size: 1rem; min-width: 1.2em; text-align: center; }
.ccy-trigger .t-code { font-weight: 800; letter-spacing: .01em; }
.ccy-trigger .t-name { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccy-trigger .t-caret { width: 16px; height: 16px; margin-left: auto; color: var(--muted); flex: none; }

.ccy-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 8px; max-height: 320px; display: flex; flex-direction: column;
}
.ccy-search {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--field);
  color: var(--text); font: inherit; padding: 8px 10px; margin-bottom: 6px;
}
.ccy-search:focus { outline: none; border-color: var(--accent-strong); }
.ccy-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.ccy-opt {
  display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 8px; cursor: pointer;
}
.ccy-opt .o-sym { font-weight: 800; min-width: 1.4em; text-align: center; }
.ccy-opt .o-code { font-weight: 700; min-width: 3em; }
.ccy-opt .o-name { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccy-opt.active { background: var(--row-hover); }
.ccy-opt.sel { color: var(--accent-strong); }
.ccy-opt.sel .o-name { color: var(--accent); }
.ccy-empty { padding: 12px; color: var(--muted); text-align: center; }

/* amount fields */
.conv-amounts { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.amount-field { flex: 1 1 0; min-width: 0; }
.amount-field .lbl { display: block; color: var(--muted); font-size: .75rem; font-weight: 600; margin-bottom: 4px; letter-spacing: .02em; }
.amount-box {
  display: flex; align-items: center; gap: 8px; background: var(--field);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.amount-box:focus-within { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.amount-box .ccy { color: var(--muted); font-weight: 700; font-size: .82rem; white-space: nowrap; }
.amount-box input {
  border: none; background: transparent; color: var(--text); width: 100%; min-width: 0;
  font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums;
  appearance: textfield; -moz-appearance: textfield;
}
.amount-box input:focus { outline: none; }
.amount-box input::-webkit-outer-spin-button,
.amount-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.conv-eq { color: var(--muted); font-weight: 700; font-size: 1.2rem; flex: none; padding-bottom: 9px; }

.amount-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  border: 1px solid var(--border); background: var(--field); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--accent-strong); color: var(--text); }

.rate-line { margin: 14px 0 0; font-size: 1.05rem; }
.rate-line strong { font-weight: 800; }
.rate-line .muted { color: var(--muted); font-size: .82rem; font-weight: 400; }

@media (max-width: 520px) {
  .conv-amounts { flex-direction: column; align-items: stretch; }
  .conv-eq { align-self: center; transform: rotate(90deg); padding: 0; }
  .ccy-trigger .t-name { display: none; }
}

.live-tag {
  display: inline-block; font-size: .62rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: #fff; background: var(--accent-strong);
  padding: 1px 6px; border-radius: 999px; vertical-align: middle;
}

.status { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---- Rates table ---- */
table.rates {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); margin-top: 22px;
}
.rates thead th {
  text-align: left; font-size: .71rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.rates th.num, .rates td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rates th.rank, .rates td.rank { width: 40px; text-align: center; color: var(--muted); font-weight: 600; }
.rates tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rates tbody tr:last-child td { border-bottom: none; }
.rates tbody tr:hover { background: var(--row-hover); }
.rates tbody tr.best { background: var(--best-bg); }
.rates tbody tr.best td:first-child { box-shadow: inset 3px 0 0 var(--accent-strong); }

.provider-cell { display: flex; align-items: center; gap: 12px; }
.pblock { display: flex; flex-direction: column; min-width: 0; }
.meta-sm { display: none; }
.meta-dim { color: var(--muted); }
.logo-chip {
  flex: none; width: 48px; height: 30px; border-radius: 8px; background: var(--chip);
  border: 1px solid var(--chip-border); display: grid; place-items: center; padding: 4px;
}
.logo-chip img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo-chip.empty { font-size: .8rem; font-weight: 700; color: #475569; }
.pname { font-weight: 600; }
.pill {
  display: inline-block; font-size: .64rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: #fff; background: var(--accent-strong);
  padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle;
}
.rcv { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.amt { font-weight: 700; }
tr.best .amt { color: var(--accent-strong); }
.delta { font-size: .76rem; color: var(--muted); font-weight: 500; }

/* ---- Article / prose content ---- */
.content { max-width: 760px; }
.content h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 12px; letter-spacing: -.02em; }
.content h2 { font-size: 1.25rem; margin: 2rem 0 .6rem; letter-spacing: -.01em; }
.content h3 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
.content p, .content li { color: var(--text); font-size: 1rem; }
.content p { margin: .7rem 0; }
.content ul, .content ol { padding-left: 1.3rem; margin: .6rem 0; }
.content li { margin: .35rem 0; }
.content .lead { font-size: 1.1rem; color: var(--muted); }
.content .updated { color: var(--muted); font-size: .85rem; margin-top: 0; }
.callout {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin: 1.2rem 0; box-shadow: var(--shadow);
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

/* details / FAQ */
.content details {
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: 4px 16px; margin: 10px 0; box-shadow: var(--shadow);
}
.content details summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; }
.content details summary::-webkit-details-marker { display: none; }
.content details summary::after { content: "+"; float: right; color: var(--muted); font-weight: 700; }
.content details[open] summary::after { content: "–"; }
.content details p { margin: 0 0 12px; color: var(--muted); }

/* ---- Footer ---- */
.site-footer {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .85rem;
}
.site-footer .links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.site-footer .links a { color: var(--muted); text-decoration: none; }
.site-footer .links a:hover { color: var(--text); }
.site-footer .fine { font-size: .8rem; line-height: 1.5; }

/* ---- Corridor hub cards ---- */
.corridor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 18px; }
.corridor-card {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow); transition: transform .15s ease, border-color .2s ease;
}
.corridor-card:hover { transform: translateY(-2px); border-color: var(--accent-strong); }
.corridor-card .cc-pair { font-weight: 700; }
.corridor-card .cc-sub { color: var(--muted); font-size: .82rem; }
.corridor-card .cc-arrow { margin-left: auto; color: var(--accent-strong); font-weight: 700; }

/* ---- Article hub cards (CSS gradient header, no image files) ---- */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }
.article-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s ease, border-color .2s ease;
}
.article-card:hover { transform: translateY(-2px); border-color: var(--accent-strong); }
.article-card .ph {
  aspect-ratio: 16 / 7; display: flex; align-items: flex-end; padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent-strong), #0ea5e9);
  color: #fff; font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
}
.article-card .ph span { background: rgba(0,0,0,.22); padding: 3px 9px; border-radius: 999px; }
.article-card .body { padding: 14px 16px; }
.article-card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.article-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }

/* ---- Article body ---- */
.content .art-banner {
  border-radius: var(--radius); padding: 22px 22px; margin: 0 0 18px; color: #fff;
  background: linear-gradient(135deg, var(--accent-strong), #0ea5e9); box-shadow: var(--shadow);
}
.content .art-banner .cat { font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.content .art-banner h1 { margin: 6px 0 0; color: #fff; }
.content .byline { color: var(--muted); font-size: .85rem; margin: 0 0 16px; }
.content img { max-width: 100%; height: auto; }
.content .table-wrap { overflow-x: auto; margin: 1.2rem 0; }
.content table { width: 100%; border-collapse: collapse; min-width: 460px; font-size: .95rem; }
.content th, .content td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.content thead th { background: var(--row-hover); font-weight: 600; }
.content hr { border: none; border-top: 1px solid var(--border); margin: 1.6rem 0; }

/* ---- Manual ad slots ---- */
.ad-slot { margin: 20px auto; text-align: center; max-width: 760px; }
.ad-slot:empty { display: none; margin: 0; }

/* ---- Responsive: compact provider cards ---- */
@media (max-width: 640px) {
  .rates, .rates tbody { display: block; }
  table.rates { border: none; background: transparent; box-shadow: none; overflow: visible; }
  .rates thead { display: none; }
  .rates tbody tr {
    display: grid; grid-template-columns: 1fr auto; column-gap: 12px;
    align-items: center; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; padding: 10px 13px; margin-bottom: 8px; box-shadow: var(--shadow);
  }
  .rates tbody tr.best { border-color: var(--best-border); }
  .rates tbody tr:hover { background: var(--card); }
  .rates tbody td { display: block; padding: 0; border: none; text-align: left; }
  .rates td.rank, .rates td.rate, .rates td.fee { display: none; }
  .rates td.provider { grid-column: 1; grid-row: 1; min-width: 0; }
  .rates td.receive { grid-column: 2; grid-row: 1; text-align: right; }
  .meta-sm { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 1px; }
  .provider-cell { gap: 10px; }
  .logo-chip { width: 40px; height: 26px; }
  .pname { font-size: .98rem; }
  .rcv { align-items: flex-end; line-height: 1.2; }
  .amt { font-size: 1.05rem; }
  .delta { font-size: .72rem; }
}
