@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=Manrope:wght@600;700;800&display=swap');

:root {
  --ink: #132820; --muted: #64756e; --green: #087356; --green-dark: #075943;
  --mint: #def4e8; --lime: #c8ef62; --cream: #f6f4ed; --surface: #fff;
  --line: #dce4df; --warning: #775a0c; --error: #8b421b;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', var(--font-body); --radius: 18px; --shadow: 0 22px 55px rgba(19,40,32,.13);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 15px/1.65 var(--font-body); overflow-wrap: break-word; }
button, input, select { font: inherit; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(8,115,86,.28); outline-offset: 3px; }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }
.skip-link { position: fixed; z-index: 20; left: 16px; top: 12px; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.topbar, main, footer { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(19,40,32,.12); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font: 800 20px/1 var(--font-display); text-decoration: none; letter-spacing: -.03em; }
.brand > span:last-child > span { color: var(--green); }
.mark { display: grid; place-items: center; width: 36px; aspect-ratio: 1; border-radius: 50%; background: var(--green); color: #fff; font-size: 18px; }
.live { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.live i { width: 8px; aspect-ratio: 1; border-radius: 50%; background: #27b57b; box-shadow: 0 0 0 5px rgba(39,181,123,.13); }

.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(310px, .72fr); align-items: center; gap: clamp(42px, 7vw, 84px); padding: clamp(56px, 8vw, 92px) 0 58px; }
.eyebrow { margin: 0 0 14px; color: var(--green); font: 700 11px/1.4 var(--font-body); letter-spacing: .14em; }
.eyebrow span { padding-inline: 7px; }
h1, h2 { font-family: var(--font-display); text-wrap: balance; }
h1 { margin: 0; font-size: clamp(42px, 6vw, 74px); line-height: 1.04; letter-spacing: -.06em; }
h1 em { color: var(--green); font-style: normal; }
.intro { max-width: 620px; margin: 24px 0 0; color: var(--muted); font-size: clamp(15px, 1.6vw, 17px); line-height: 1.75; }
.intro strong { color: var(--ink); font-weight: 700; }
.hero-points { display: flex; flex-wrap: wrap; gap: 11px 20px; margin-top: 26px; font-size: 12px; font-weight: 600; }
.hero-points span { display: flex; align-items: center; gap: 7px; }
.hero-points i { display: grid; place-items: center; width: 21px; aspect-ratio: 1; border-radius: 50%; background: var(--mint); color: var(--green); font-style: normal; }

.amount-card { min-width: 0; padding: clamp(23px, 3vw, 30px); border-radius: 24px; background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.amount-card label { color: #adbbb6; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.amount { display: flex; align-items: center; gap: 8px; margin: 7px 0 20px; padding: 6px 0 16px; border-bottom: 1px solid #41544d; }
.amount > span { color: var(--lime); font: 700 25px/1 var(--font-display); }
.amount input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: #fff; font: 700 clamp(25px, 3vw, 31px)/1.3 var(--font-display); }
.amount b { color: #adbbb6; font-size: 11px; }
.service-select { width: 100%; margin: 8px 0 16px; padding: 12px 38px 12px 13px; border: 1px solid #41544d; border-radius: 10px; background: #1c352c; color: #fff; }
.conversion-result { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: #adbbb6; font-size: 11px; }
.conversion-result strong { color: var(--lime); font: 700 19px/1.3 var(--font-display); text-align: right; }

.summary { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); margin-bottom: clamp(66px, 8vw, 92px); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.summary > div { min-width: 0; padding: 24px clamp(20px, 3vw, 31px); }
.summary > div + div { border-left: 1px solid var(--line); }
.summary span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.summary strong { display: block; font: 800 clamp(21px, 2.7vw, 27px)/1.25 var(--font-display); letter-spacing: -.03em; }
.summary small { color: var(--muted); font-size: 11px; }

.content, .history-section { margin-bottom: clamp(68px, 8vw, 90px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-head .eyebrow { margin-bottom: 7px; }
.section-head h2 { margin: 0; font-size: clamp(27px, 3vw, 34px); line-height: 1.2; letter-spacing: -.045em; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.toolbar .search { position: relative; flex: 1; }
.toolbar .search > span:first-child { position: absolute; left: 14px; top: 50%; color: var(--muted); font-size: 18px; transform: translateY(-53%); }
.toolbar input, .toolbar select, .chart-controls select { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.toolbar input { width: 100%; padding: 10px 13px 10px 43px; }
.toolbar select, .chart-controls select { padding: 9px 35px 9px 13px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 840px; border-collapse: collapse; }
th { padding: 14px 17px; border-bottom: 1px solid var(--line); background: #fafbf8; color: #788781; font-size: 9px; font-weight: 700; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 17px; border-bottom: 1px solid #edf1ee; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcf9; }
.rank { color: #96a29e; font-weight: 700; }
.provider { font: 700 14px/1.3 var(--font-display); }
.receive { font: 800 15px/1.3 var(--font-display); white-space: nowrap; }
.fee, .time, .difference { color: var(--muted); }
.time small { display: block; margin-top: 3px; color: #8e9b96; font-size: 9px; }
.loading { padding: 48px!important; color: var(--muted); text-align: center!important; }
.stale-row { opacity: .58; }
.notice { margin: 0 0 13px; padding: 12px 15px; border-radius: 10px; font-size: 12px; }
.notice.warning { background: #fff6d9; color: var(--warning); }
.notice.error { margin-top: 13px; background: #fff0e7; color: var(--error); }

.chart-providers { display: flex; flex-wrap: wrap; gap: 9px 17px; margin: -5px 0 16px; color: var(--muted); font-size: 11px; }
.chart-providers label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chart-providers input { accent-color: var(--green); }
.chart-providers i { width: 8px; aspect-ratio: 1; border-radius: 50%; }
.chart-card { position: relative; min-height: 360px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.chart-card canvas { display: block; width: 100%; height: 320px; }
.chart-card > p { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; color: var(--muted); text-align: center; }
.chart-tooltip { position: absolute; z-index: 2; width: 190px; padding: 10px 12px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 11px; pointer-events: none; box-shadow: 0 10px 28px rgba(19,40,32,.24); }
.chart-tooltip small { color: #bac6c1; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding-block: 29px max(42px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(19,40,32,.12); }
footer p { max-width: 520px; margin: 0; color: var(--muted); font-size: 11px; text-align: right; }
footer p a { color: var(--green); font-weight: 600; text-decoration: none; }
footer p a:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .topbar, main, footer { width: min(100% - 32px, 680px); }
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 50px; }
  .hero-copy { max-width: 650px; }
  .amount-card { width: 100%; max-width: 540px; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  table { min-width: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); padding: 12px 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
  td { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border: 0; text-align: right; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 600; text-align: left; }
  td.rank { display: none; }
  td:nth-child(2), td.loading { grid-column: 1 / -1; }
  td:nth-child(2) { margin-bottom: 3px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .topbar, main, footer { width: calc(100% - 28px); }
  .topbar { min-height: 66px; }
  .live span { font-size: 0; }
  .live span::after { content: 'Mỗi 15 phút'; font-size: 10px; }
  .hero { gap: 30px; padding: 42px 0 46px; }
  h1 { font-size: clamp(38px, 12.2vw, 54px); }
  .hero-points { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-points span:last-child { grid-column: 1 / -1; }
  .amount-card { border-radius: 19px; }
  .summary { grid-template-columns: 1fr; margin-bottom: 66px; }
  .summary > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .section-head { align-items: flex-start; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar select { width: 100%; }
  tbody tr { grid-template-columns: 1fr; }
  td, td:nth-child(2), td:last-child, td.loading { grid-column: 1; }
  .chart-card { min-height: 330px; padding: 10px 4px 10px 0; }
  .chart-card canvas { height: 300px; }
  .chart-providers { max-height: 116px; overflow-y: auto; }
  footer { align-items: flex-start; flex-direction: column; }
  footer p { text-align: left; }
}

@media (max-width: 360px) {
  .topbar, main, footer { width: calc(100% - 22px); }
  .brand { font-size: 18px; }
  .mark { width: 32px; }
  .hero-points { grid-template-columns: 1fr; }
  .hero-points span:last-child { grid-column: auto; }
  .amount-card { padding: 20px 17px; }
  .conversion-result { align-items: flex-start; flex-direction: column; gap: 4px; }
  .conversion-result strong { text-align: left; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { scroll-behavior: auto!important; transition: none!important; } }
