:root {
    --ink: #edf2fb;
    --muted: #9ca9bd;
    --subtle: #6e7b91;
    --canvas: #08101d;
    --canvas-deep: #060c16;
    --surface: rgba(16, 27, 45, .76);
    --line: rgba(148, 172, 214, .17);
    --line-strong: rgba(148, 172, 214, .28);
    --blue: #82a8ff;
    --blue-strong: #a2baff;
    --success: #63d9ac;
    --warning: #f0c778;
    --danger: #ff9a9a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.55; }
body::before { content: ""; position: fixed; z-index: -2; inset: 0; background: radial-gradient(circle at 76% -12%, rgba(61,111,201,.17), transparent 35rem), radial-gradient(circle at 4% 18%, rgba(50,92,164,.09), transparent 25rem), linear-gradient(180deg, #0a1221 0, var(--canvas) 46rem); pointer-events: none; }
body::after { content: ""; position: fixed; z-index: -1; inset: 0; opacity: .12; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 72px 72px; mask-image: linear-gradient(to bottom, black, transparent 64%); }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #b7cbff; outline-offset: 3px; }
.shell { width: min(1080px, calc(100% - 44px)); margin: 0 auto; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: 8px 12px; border-radius: 7px; background: #fff; color: #09111e; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid rgba(148,172,214,.11); background: rgba(7,13,24,.88); backdrop-filter: blur(18px); }
.header-shell { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.header-left, .header-actions { display: flex; align-items: center; }
.header-left { gap: 12px; min-width: 0; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 4px 7px; border: 1px solid rgba(193,209,239,.52); border-radius: 8px; background: linear-gradient(135deg, #fbfdff, #dce8fa); box-shadow: 0 6px 18px rgba(0,0,0,.16); }
.brand-logo { display: block; width: 92px; height: auto; }
.header-divider { width: 1px; height: 22px; background: var(--line); }
.header-label { color: #aebad0; font-size: 12px; font-weight: 720; letter-spacing: .01em; }
.header-actions { position: relative; gap: 8px; }
.source-status, .refresh-button { border: 1px solid var(--line); background: rgba(17,29,49,.64); color: var(--muted); }
.source-status { min-height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 999px; font-size: 11px; font-weight: 720; }
.refresh-button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border-radius: 8px; font-size: 18px; }
.source-status:hover, .refresh-button:hover { border-color: var(--line-strong); color: var(--ink); background: rgba(28,45,73,.78); }
.refresh-button.is-loading span { display: inline-block; animation: spin .8s linear infinite; }
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(99,217,172,.09); }
.source-status.is-warning .status-dot { background: var(--warning); box-shadow: 0 0 0 3px rgba(240,199,120,.09); }
.source-status.is-error .status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,154,154,.09); }
.source-popover { position: absolute; top: calc(100% + 9px); right: 42px; width: 248px; padding: 9px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(8,16,29,.98); box-shadow: 0 20px 48px rgba(0,0,0,.34); }
.source-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 6px; color: var(--muted); font-size: 11px; }
.source-line + .source-line { border-top: 1px solid rgba(148,172,214,.08); }
.source-line b { color: #dce5f7; font-weight: 680; }
.source-state--fresh { color: var(--success); }
.source-state--stale { color: var(--warning); }
.source-state--unavailable { color: var(--danger); }
.source-cache-note { margin-top: 7px; padding: 8px; border-top: 1px solid var(--line); color: var(--warning); font-size: 10px; line-height: 1.45; }

.dashboard { padding: 34px 0 28px; }
.dashboard-head { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 42px; padding-bottom: 25px; border-bottom: 1px solid rgba(148,172,214,.12); }
.eyebrow, .section-kicker { margin: 0; color: var(--blue-strong); font-size: 9px; font-weight: 820; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { color: #f3f6fc; letter-spacing: -.045em; line-height: 1.08; }
h1 { margin: 6px 0 7px; font-size: clamp(1.85rem, 3vw, 2.35rem); font-weight: 750; }
h2 { margin: 4px 0 0; font-size: clamp(1.35rem, 2.3vw, 1.8rem); font-weight: 730; }
.intro { max-width: 680px; margin: 0; color: var(--muted); font-size: 13px; }
.amount-control { display: grid; justify-items: end; gap: 7px; }
.amount-control > span { color: var(--subtle); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.amount-buttons { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: rgba(10,19,34,.64); }
.amount-buttons button { min-width: 52px; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 740; }
.amount-buttons button:hover { color: var(--ink); background: rgba(130,168,255,.07); }
.amount-buttons button.is-active { background: rgba(130,168,255,.16); color: #e1eaff; box-shadow: inset 0 0 0 1px rgba(130,168,255,.15); }

.data-section { padding: 29px 0 7px; }
.data-section + .data-section { margin-top: 24px; padding-top: 31px; border-top: 1px solid rgba(148,172,214,.1); }
.data-section--last { padding-bottom: 18px; }
.section-title-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,390px); align-items: end; gap: 40px; margin-bottom: 18px; }
.section-title-row > p { margin: 0 0 2px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.section-title-row > p strong { color: #cbd6eb; font-weight: 700; }

.stable-grid, .market-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(21,37,62,.72), rgba(10,20,36,.55)); box-shadow: 0 16px 42px rgba(0,0,0,.13); }
.panel-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 17px; border-bottom: 1px solid rgba(148,172,214,.09); }
.panel-head > div { display: grid; gap: 2px; }
.panel-head strong { color: #e5ebf7; font-size: 14px; font-weight: 710; }
.asset-code { color: var(--blue); font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.action-label { padding: 4px 7px; border: 1px solid rgba(99,217,172,.18); border-radius: 999px; background: rgba(99,217,172,.05); color: #8ce6c2; font-size: 8px; font-weight: 850; letter-spacing: .1em; }

.best-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(148,172,214,.08); border-bottom: 1px solid rgba(148,172,214,.08); }
.best-item { min-height: 72px; padding: 13px 17px; background: rgba(7,15,27,.42); }
.best-label { display: block; margin-bottom: 3px; color: var(--subtle); font-size: 8px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.best-value { display: block; color: var(--success); font-size: 1.16rem; font-weight: 770; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.best-provider { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; }
.best-empty { color: var(--subtle); }

.quote-list { padding: 5px 11px; }
.quote-row { display: grid; grid-template-columns: 24px minmax(90px,1fr) 64px minmax(98px,auto); align-items: center; gap: 7px; min-height: 37px; padding: 4px 5px; }
.quote-row + .quote-row { border-top: 1px solid rgba(148,172,214,.065); }
.quote-row:hover { background: rgba(130,168,255,.035); }
.quote-rank { color: #6f80a1; font-size: 10px; font-weight: 760; font-variant-numeric: tabular-nums; }
.quote-name { min-width: 0; color: #d8e1f2; font-size: 11px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venue-pill { justify-self: start; padding: 2px 5px; border: 1px solid rgba(148,172,214,.12); border-radius: 999px; color: #8e9db4; font-size: 7px; font-weight: 850; letter-spacing: .07em; }
.venue-pill--p2p { color: #b7c9fa; border-color: rgba(130,168,255,.17); background: rgba(130,168,255,.04); }
.quote-price { justify-self: end; color: #eef2f8; font-size: 11px; font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-row.is-best .quote-price { color: var(--success); }
.quote-row.is-stale { opacity: .43; }
.quote-note { grid-column: 2/-1; margin: -2px 0 2px; color: var(--warning); font-size: 8px; }
.show-all { width: calc(100% - 22px); margin: 3px 11px 10px; padding: 7px 10px; border: 1px solid rgba(148,172,214,.12); border-radius: 7px; background: rgba(8,17,31,.25); color: #9eacc1; font-size: 10px; font-weight: 700; }
.show-all:hover { border-color: var(--line-strong); color: #dce5f5; }
.panel-foot { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 8px 16px; border-top: 1px solid rgba(148,172,214,.07); color: #66758e; font-size: 9px; }
.empty-state { padding: 23px 15px; color: var(--muted); font-size: 11px; text-align: center; }

.market-list { padding: 2px 15px 7px; }
.market-row { min-height: 62px; display: grid; grid-template-columns: minmax(105px,1fr) auto; align-items: center; gap: 16px; padding: 9px 2px; }
.market-row + .market-row { border-top: 1px solid rgba(148,172,214,.075); }
.market-provider { display: grid; gap: 2px; min-width: 0; }
.market-provider strong { color: #dce5f5; font-size: 11px; font-weight: 680; }
.market-provider span { color: var(--subtle); font-size: 9px; }
.reference-tag { margin-left: 5px; color: #8299c7; font-size: 7px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.market-value { text-align: right; color: #f2f5fb; font-size: 14px; font-weight: 760; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.market-value small { display: block; margin-top: 1px; color: var(--subtle); font-size: 8px; font-weight: 620; letter-spacing: 0; }
.market-row.is-unavailable { opacity: .48; }
.market-row.is-stale { opacity: .68; }

.kraken-panel { overflow-x: auto; }
.kraken-table { min-width: 600px; }
.kraken-row { display: grid; grid-template-columns: 1.05fr repeat(3,1fr); gap: 18px; align-items: center; min-height: 48px; padding: 0 17px; }
.kraken-row + .kraken-row { border-top: 1px solid rgba(148,172,214,.075); }
.kraken-row--header { min-height: 36px; color: #6f7f99; background: rgba(7,15,27,.28); font-size: 8px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.kraken-pair { color: #dce5f5; font-size: 11px; font-weight: 720; }
.kraken-pair small { margin-left: 6px; color: var(--warning); font-size: 7px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.kraken-heading-cell, .kraken-cell { text-align: right; }
.kraken-cell { color: #e7edf8; font-size: 11px; font-weight: 660; font-variant-numeric: tabular-nums; }
.kraken-row.is-stable .kraken-cell--bid { color: var(--success); font-weight: 780; }
.kraken-row.is-unavailable { opacity: .45; }
.kraken-row.is-stale { opacity: .68; }

.dashboard-meta { display: flex; justify-content: flex-end; gap: 7px; padding: 19px 1px 2px; color: var(--subtle); font-size: 9px; }
.meta-separator { opacity: .5; }
.site-footer { margin-top: 28px; border-top: 1px solid rgba(148,172,214,.09); background: rgba(5,11,20,.42); }
.footer-shell { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--subtle); font-size: 9px; }
.footer-shell span:first-child { color: #9ca9bd; font-weight: 690; }
.noscript { position: fixed; inset: auto 14px 14px; z-index: 50; padding: 11px 13px; border: 1px solid rgba(255,154,154,.35); border-radius: 9px; background: #241619; color: #ffd1d1; font-size: 12px; }

.loading-line { height: 10px; border-radius: 4px; background: linear-gradient(90deg, rgba(148,172,214,.06), rgba(148,172,214,.14), rgba(148,172,214,.06)); background-size: 220% 100%; animation: shimmer 1.2s linear infinite; }
.loading-line--wide { width: 64%; }
.loading-line--price { width: 76px; margin-left: auto; }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
    .dashboard-head, .section-title-row { grid-template-columns: 1fr; align-items: start; gap: 18px; }
    .amount-control { justify-items: start; }
    .section-title-row > p { max-width: 620px; }
}

@media (max-width: 680px) {
    .shell { width: min(100% - 26px,1080px); }
    .header-shell { min-height: 58px; }
    .brand { padding: 3px 6px; }
    .brand-logo { width: 80px; }
    .header-divider { height: 18px; }
    .header-label { font-size: 10px; }
    .source-status { width: 34px; justify-content: center; padding: 0; }
    .source-status #source-status-text { display: none; }
    .source-popover { right: 0; width: min(248px,calc(100vw - 26px)); }
    .dashboard { padding-top: 31px; }
    h1 { font-size: clamp(1.72rem,8vw,2.05rem); }
    .intro { font-size: 12px; }
    .amount-buttons { width: 100%; }
    .amount-buttons button { flex: 1; min-width: 0; }
    .stable-grid, .market-grid { grid-template-columns: 1fr; }
    .data-section { padding-top: 29px; }
    .data-section + .data-section { margin-top: 22px; padding-top: 31px; }
    .quote-row { grid-template-columns: 22px minmax(88px,1fr) minmax(96px,auto); }
    .venue-pill { display: none; }
    .quote-note { grid-column: 2/-1; }
    .footer-shell { min-height: 86px; display: grid; align-content: center; gap: 5px; }
}

@media (max-width: 420px) {
    .header-label, .header-divider { display: none; }
    .best-grid { grid-template-columns: 1fr; }
    .best-item { min-height: 63px; }
    .best-item + .best-item { border-top: 1px solid rgba(148,172,214,.08); }
    .amount-buttons button { padding-left: 4px; padding-right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* v2.1 refinements */
.asset-heading { display: flex !important; align-items: center; gap: 10px; min-width: 0; }
.asset-heading-copy { display: grid; gap: 2px; min-width: 0; }
.coin-icon-slot { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; }
.coin-icon-slot--tiny { width: 20px; height: 20px; flex-basis: 20px; }
.coin-icon { display: block; width: 100%; height: 100%; object-fit: contain; filter: saturate(.92) brightness(.98); }
.coin-icon.is-missing { visibility: hidden; }
.panel-title { margin: 0; color: #e5ebf7; font-size: 14px; font-weight: 710; letter-spacing: 0; line-height: 1.2; }
.market-section-note { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 18px; }
.market-section-note > p:last-child { max-width: 430px; margin: 0 0 2px; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: right; }
.amount-custom[hidden] { display: none !important; }
.amount-custom input.is-invalid { border-color: rgba(255,154,154,.58); box-shadow: 0 0 0 2px rgba(255,154,154,.07); }
.quote-row { grid-template-columns: 24px minmax(90px,1fr) minmax(98px,auto); }
.quote-row.is-preferred { background: linear-gradient(90deg, rgba(130,168,255,.075), rgba(130,168,255,.018) 58%, transparent); box-shadow: inset 2px 0 0 rgba(130,168,255,.48); }
.quote-row.is-preferred .quote-name { color: #dce8ff; font-weight: 800; }
.quote-row.is-preferred .quote-price { color: #dbe8ff; font-weight: 800; }
.best-item--preferred .best-label { color: #8ea9dd; }
.best-item--preferred .best-value { color: #c8d9ff; }
.best-item--preferred .best-provider { color: #aebfdf; font-weight: 720; }
.market-provider-copy { display: grid; gap: 2px; min-width: 0; }
.market-row.is-preferred { background: linear-gradient(90deg, rgba(130,168,255,.05), transparent 72%); }
.market-row.is-preferred .market-provider strong { color: #dce8ff; font-weight: 800; }
.kraken-pair { display: flex; align-items: center; gap: 10px; }
.kraken-pair-text { display: inline-flex; align-items: center; gap: 7px; }
.kraken-pair .coin-icon-slot { opacity: .92; }

@media (max-width: 760px) {
    .market-section-note { display: grid; gap: 8px; }
    .market-section-note > p:last-child { max-width: none; text-align: left; }
}

@media (max-width: 420px) {
    .coin-icon-slot { width: 26px; height: 26px; flex-basis: 26px; }
    .coin-icon-slot--tiny { width: 18px; height: 18px; flex-basis: 18px; }
    .quote-row { grid-template-columns: 22px minmax(88px,1fr) minmax(96px,auto); }
}

/* Reference amount custom input */
.amount-custom { display: flex; align-items: center; justify-content: flex-end; gap: 6px; width: 100%; }
.amount-custom input { width: 132px; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(8,17,31,.58); color: var(--ink); font: inherit; font-size: 11px; font-weight: 680; outline: none; }
.amount-custom input::placeholder { color: var(--subtle); }
.amount-custom input:focus { border-color: rgba(130,168,255,.45); box-shadow: 0 0 0 2px rgba(130,168,255,.07); }
.amount-custom button { min-height: 34px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: rgba(130,168,255,.08); color: #c7d7f7; font-size: 10px; font-weight: 760; }
.amount-custom button:hover { border-color: var(--line-strong); color: #edf3ff; }
.quote-subheading { margin: 6px 5px 1px; padding: 8px 0 4px; border-top: 1px solid rgba(148,172,214,.09); color: var(--subtle); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 820px) { .amount-custom { justify-content: flex-start; } }
@media (max-width: 420px) { .amount-custom input { width: min(150px,58vw); } }

/* v2.2 net pricing and header ticker */
.header-shell { display: grid; grid-template-columns: auto minmax(0,1fr) auto; }
.header-market-strip { min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.header-quote { min-width: 0; display: flex; align-items: center; gap: 7px; padding: 5px 11px; border-left: 1px solid rgba(148,172,214,.11); }
.header-quote:first-child { border-left: 0; }
.header-coin { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; }
.header-coin img { display: block; width: 18px; height: 18px; object-fit: contain; filter: saturate(.9) brightness(.98); }
.header-quote-copy { min-width: 0; display: grid; gap: 0; line-height: 1.05; }
.header-quote-copy small { color: #71819b; font-size: 7px; font-weight: 850; letter-spacing: .08em; }
.header-quote-copy strong { color: #dce5f5; font-size: 10.5px; font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; }
#header-quote-usdc .header-quote-copy strong, #header-quote-usdt .header-quote-copy strong { color: #9fe7c9; }
.action-label { white-space: nowrap; }
.quote-price { display: grid; justify-items: end; line-height: 1.05; }
.quote-price > span { display: block; }
.quote-price small { margin-top: 2px; color: #687791; font-size: 7px; font-weight: 780; letter-spacing: .055em; text-transform: uppercase; }
.quote-row.is-best .quote-price small { color: rgba(99,217,172,.62); }
.quote-row.is-preferred .quote-price small { color: #7f94bd; }

@media (max-width: 980px) {
    .header-quote { padding-left: 7px; padding-right: 7px; }
    .header-quote-copy strong { font-size: 9.5px; }
    .header-coin, .header-coin img { width: 16px; height: 16px; }
    .header-coin { flex-basis: 16px; }
}

@media (max-width: 760px) {
    .header-shell { grid-template-columns: minmax(0,1fr) auto; }
    .header-market-strip { display: none; }
}

/* v2.3 final polish */
.header-label { font-size: 12.5px; }
.source-status { font-size: 11.5px; }
.header-quote-copy small { font-size: 7.5px; }
.header-quote-copy strong { font-size: 11.25px; }

.dashboard { padding-top: 30px; }
.dashboard-head { gap: 34px; padding-bottom: 21px; }
.eyebrow { font-size: 8px; }
h1 { margin-top: 5px; margin-bottom: 5px; font-size: clamp(1.68rem, 2.6vw, 2.08rem); }
.intro { font-size: 11.5px; }
.amount-control > span { font-size: 8.5px; }

.exchange-logo-slot { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; }
.exchange-logo-slot--section { width: 24px; height: 24px; flex-basis: 24px; }
.exchange-icon { display: block; width: 100%; height: 100%; object-fit: contain; }
.exchange-icon.is-missing { visibility: hidden; }
.market-provider { display: flex; align-items: center; gap: 9px; }
.market-provider .exchange-logo-slot { opacity: .94; }
.section-brand-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.section-brand-heading h2 { margin: 0; }

.footer-shell { align-items: flex-start; padding-top: 17px; padding-bottom: 17px; }
.footer-shell > span { flex: 0 0 auto; padding-top: 1px; }
.fine-print { max-width: 760px; margin: 0; color: var(--subtle); font-size: 8.5px; line-height: 1.55; text-align: right; }

@media (max-width: 980px) {
    .header-quote-copy strong { font-size: 10.25px; }
}

@media (max-width: 680px) {
    h1 { font-size: clamp(1.58rem, 7vw, 1.9rem); }
    .intro { font-size: 11px; }
    .footer-shell { align-content: center; }
    .fine-print { max-width: none; text-align: left; }
}
.amount-buttons button { font-size: 10.5px; }
