/* =============================================================
   Axiom Alpha — Coinbase-inspired design system
   Reference: getdesign.md/coinbase
   - Canvas-white default with one Coinbase Blue accent (#0052ff)
   - Editorial 80px display headlines @ weight 400
   - Pill geometry on every CTA, 24px radius on cards
   - Inter (display + body) + JetBrains Mono (tabular numbers)
   - Legacy --brand-* tokens are kept as aliases so existing
     templates inherit the new palette without rewrites.
   ============================================================= */

:root {
    /* ----- Coinbase tokens (canonical) ----- */
    --cb-primary: #0052ff;
    --cb-primary-active: #003ecc;
    --cb-primary-disabled: #a8b8cc;

    --cb-ink: #0a0b0d;
    --cb-body: #5b616e;
    --cb-muted: #7c828a;
    --cb-muted-soft: #a8acb3;

    --cb-hairline: #dee1e6;
    --cb-hairline-soft: #eef0f3;

    --cb-canvas: #ffffff;
    --cb-surface-soft: #f7f7f7;
    --cb-surface-card: #ffffff;
    --cb-surface-strong: #eef0f3;
    --cb-surface-dark: #0a0b0d;
    --cb-surface-dark-elevated: #16181c;

    --cb-on-primary: #ffffff;
    --cb-on-dark: #ffffff;
    --cb-on-dark-soft: #a8acb3;

    --cb-up: #05b169;
    --cb-down: #cf202f;
    --cb-warn: #f4b000;

    /* Radius scale */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 100px;
    --r-full: 9999px;

    /* Spacing */
    --s-xxs: 4px;
    --s-xs: 8px;
    --s-sm: 12px;
    --s-base: 16px;
    --s-md: 20px;
    --s-lg: 24px;
    --s-xl: 32px;
    --s-xxl: 48px;
    --s-section: 96px;

    /* Shadow — single tier */
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(10, 11, 13, 0.04);
    --shadow-pop: 0 8px 32px rgba(10, 11, 13, 0.12);

    /* ----- Legacy aliases — point old token names at Coinbase palette
       so var(--brand-teal), var(--brand-light) etc. still resolve. ----- */
    --brand-dark: var(--cb-surface-dark);
    --brand-light: var(--cb-ink);          /* primary text on light */
    --brand-teal: var(--cb-primary);       /* the single accent */
    --brand-teal-light: var(--cb-primary-active);

    --bg-color: var(--cb-canvas);
    --surface: var(--cb-canvas);
    --surface-hover: var(--cb-surface-strong);
    --surface-border: var(--cb-hairline);

    --text-primary: var(--cb-ink);
    --text-secondary: var(--cb-body);

    --accent: var(--cb-primary);
    --accent-glow: rgba(0, 82, 255, 0.18);

    --success: var(--cb-up);
    --danger: var(--cb-down);
    --warning: var(--cb-warn);

    --nav-bg: rgba(255, 255, 255, 0.92);
    --nav-border: var(--cb-hairline);
    --nav-hover: var(--cb-surface-strong);
    --nav-text: #5b616e;
    --nav-text-active: var(--cb-primary);
}

/* =============================================================
   Dark mode — Coinbase editorial-hero canvas (#0a0b0d)
   ============================================================= */
html[data-theme="dark"] {
    --cb-canvas: #0a0b0d;
    --cb-surface-soft: #0a0b0d;
    --cb-surface-card: #16181c;
    --cb-surface-strong: #16181c;
    --cb-hairline: #2a2d33;
    --cb-hairline-soft: #1c1f24;

    --cb-ink: #ffffff;
    --cb-body: #a8acb3;
    --cb-muted: #7c828a;
    --cb-muted-soft: #5b616e;

    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 8px 32px rgba(0, 0, 0, 0.6);

    /* Legacy alias overrides */
    --brand-dark: #16181c;
    --brand-light: #ffffff;
    --bg-color: #0a0b0d;
    --surface: #16181c;
    --surface-hover: #1c1f24;
    --surface-border: #2a2d33;
    --text-primary: #ffffff;
    --text-secondary: #a8acb3;

    --nav-bg: rgba(10, 11, 13, 0.92);
    --nav-border: #2a2d33;
    --nav-hover: #16181c;
    --nav-text: #a8acb3;
    --nav-text-active: #ffffff;
}

/* =============================================================
   Reset + Typography (Inter for display/body, JetBrains Mono
   for tabular numbers — substitutes documented in DESIGN.md)
   ============================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Numerical / mono surface — apply this class on price cells */
.cb-mono,
[data-price-val],
[data-change-val] {
    font-family: 'JetBrains Mono', 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-feature-settings: "tnum" 1, "zero" 1;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: 0;
}

/* Display headlines — Coinbase keeps display weight at 400, never 700 */
h1, h2, h3, h4, h5, h6 {
    color: var(--cb-ink);
    font-weight: 400;
    letter-spacing: -0.025em;
    line-height: 1.05;
}
h1 { font-size: clamp(2.5rem, 5vw, 5rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(2rem, 3.5vw, 3.25rem); letter-spacing: -0.03em; }
h3 { font-size: clamp(1.5rem, 2.5vw, 2.25rem); letter-spacing: -0.025em; }
h4 { font-size: 1.5rem; letter-spacing: -0.02em; }
h5 { font-size: 1.125rem; font-weight: 600; letter-spacing: 0; line-height: 1.33; }
h6 { font-size: 1rem; font-weight: 600; letter-spacing: 0; line-height: 1.25; }

/* Accessible focus ring */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--cb-primary);
    outline-offset: 2px;
    border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible {
    outline: 2px solid var(--cb-primary);
    outline-offset: 2px;
}

html {
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--cb-canvas);
    color: var(--cb-body);
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    line-height: 1.5;
    transition: background-color 0.2s ease, color 0.2s ease;
}

@supports not (overflow: clip) {
    html { overflow-x: visible; }
    body { overflow-x: hidden; }
}

/* =============================================================
   Top navigation — white canvas, 64px height
   ============================================================= */
.topnav {
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--cb-hairline);
    padding: 0 16px;
    height: 64px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
}
.topnav-inner {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    gap: 8px;
    overflow: visible;
}
.topnav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    padding: 6px 8px;
    border-radius: var(--r-md);
    transition: background 0.15s;
}
.topnav-logo:hover { background: var(--cb-surface-strong); }
.topnav-logo img {
    height: 24px;
    width: auto;
    /* Light mode (default): tint to Coinbase Blue using a filter chain.
       The chain produces a near-perfect match for #0052ff from any opaque PNG.
       Dark mode below inverts to white instead. */
    filter: brightness(0) saturate(100%) invert(13%) sepia(99%) saturate(7464%) hue-rotate(225deg) brightness(101%) contrast(109%);
}
html[data-theme="dark"] .topnav-logo img {
    filter: brightness(0) invert(1);
}
.topnav-logo span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cb-ink);
    letter-spacing: -0.02em;
}

.topnav-search {
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 360px;
    margin-left: 8px;
}
.topnav-search form { position: relative; width: 100%; min-width: 0; }
.topnav .topnav-search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 40px;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    background: var(--cb-surface-strong);
    color: var(--cb-ink);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.topnav .topnav-search input::placeholder { color: var(--cb-muted); }
.topnav .topnav-search input:focus {
    background: var(--cb-canvas);
    border-color: var(--cb-primary);
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
}
.topnav-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cb-muted);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
}

/* Search autocomplete dropdown */
.search-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--cb-canvas);
    border: 1px solid var(--cb-hairline);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    max-height: 360px;
    overflow-y: auto;
    display: none;
    z-index: 200;
    padding: 6px;
}
.search-suggest.open { display: block; }
.search-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--cb-ink);
    font-size: 14px;
    transition: background 0.12s;
    text-decoration: none;
    border-radius: var(--r-sm);
}
.search-suggest-item:hover,
.search-suggest-item.active { background: var(--cb-surface-strong); }
.search-suggest-item .ss-flag { font-size: 1rem; flex-shrink: 0; }
.search-suggest-item .ss-sym { font-weight: 600; color: var(--cb-ink); min-width: 64px; }
.search-suggest-item .ss-name {
    color: var(--cb-body);
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-suggest-item .ss-mkt {
    font-size: 11px;
    font-weight: 600;
    color: var(--cb-body);
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: var(--cb-surface-strong);
    flex-shrink: 0;
}
.search-suggest-empty {
    padding: 16px;
    text-align: center;
    color: var(--cb-muted);
    font-size: 13px;
}

.topnav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
    overflow: visible;
    flex-wrap: nowrap;
    min-width: 0;
}
.topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px;
    border-radius: var(--r-sm);
    color: var(--cb-body);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    transition: color 0.12s, background 0.12s;
    white-space: nowrap;
    height: 36px;
    flex-shrink: 0;
}
.topnav-link:hover { color: var(--cb-ink); background: var(--cb-surface-strong); }
.topnav-link.active { color: var(--cb-primary); }

/* Icon-only nav links (e.g. About help icon) — square aspect, no label */
.topnav-link-icon {
    padding: 8px;
    width: 36px;
    min-width: 36px;
    justify-content: center;
    flex-shrink: 0;
}

.topnav-divider {
    width: 1px;
    height: 20px;
    background: var(--cb-hairline);
    margin: 0 6px;
    flex-shrink: 0;
}

/* CTA pills — the signature Coinbase button shape */
.topnav-auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 20px;
    border-radius: var(--r-pill);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
    height: 40px;
    line-height: 1;
}
.topnav-auth-login {
    color: var(--cb-ink);
    background: transparent;
    border: 1px solid transparent;
}
.topnav-auth-login:hover { background: var(--cb-surface-strong); }
.topnav-auth-signup {
    background: var(--cb-primary);
    color: var(--cb-on-primary);
    border: 1px solid var(--cb-primary);
}
.topnav-auth-signup:hover { background: var(--cb-primary-active); border-color: var(--cb-primary-active); }

.topnav-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border-radius: var(--r-pill);
    background: var(--cb-surface-strong);
    border: 1px solid transparent;
    font-size: 13px;
    color: var(--cb-ink);
    font-weight: 600;
    height: 36px;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}
.topnav-user-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

/* =============================================================
   Avatar dropdown — replaces user pill + settings + sign-out icons.
   Single circle button with first-letter initial. Click toggles a
   dropdown menu with the user's name, settings, upgrade, and sign-out.
   ============================================================= */
.topnav-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.topnav-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--r-full);
    background: var(--cb-primary);
    color: var(--cb-on-primary);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    transition: filter 0.12s, transform 0.1s;
    padding: 0;
    line-height: 1;
}
.topnav-avatar:hover { filter: brightness(0.92); }
.topnav-avatar:active { transform: scale(0.96); }
.topnav-avatar:focus-visible {
    outline: 2px solid var(--cb-primary);
    outline-offset: 2px;
}

.topnav-avatar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--cb-canvas);
    border: 1px solid var(--cb-hairline);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pop);
    padding: 6px;
    display: none;
    z-index: 200;
    animation: avatarMenuIn 0.12s ease-out;
}
.topnav-avatar-menu.open { display: block; }
@keyframes avatarMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.topnav-avatar-menu-header {
    padding: 12px 12px 10px;
    border-bottom: 1px solid var(--cb-hairline-soft);
    margin-bottom: 4px;
}
.topnav-avatar-menu-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--cb-ink);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.topnav-avatar-menu-email {
    font-size: 12px;
    color: var(--cb-muted);
    margin-top: 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topnav-avatar-menu-items {
    padding: 4px 0;
}
.topnav-avatar-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    background: transparent;
    border: none;
    color: var(--cb-ink);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: background 0.12s;
    font-family: inherit;
    line-height: 1.2;
}
.topnav-avatar-menu-item:hover {
    background: var(--cb-surface-strong);
    color: var(--cb-ink);
}
.topnav-avatar-menu-item i,
.topnav-avatar-menu-item svg {
    color: var(--cb-muted);
    flex-shrink: 0;
}

.topnav-avatar-menu-footer {
    padding: 4px 0 0;
    border-top: 1px solid var(--cb-hairline-soft);
    margin-top: 4px;
}
.topnav-avatar-menu-signout { color: var(--cb-down); }
.topnav-avatar-menu-signout:hover { color: var(--cb-down); background: rgba(207, 32, 47, 0.08); }
.topnav-avatar-menu-signout i,
.topnav-avatar-menu-signout svg { color: var(--cb-down); }

/* Icon-only nav buttons (settings, sign-out, theme) */
.topnav-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--r-full);
    background: transparent;
    border: none;
    color: var(--cb-body);
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.12s, color 0.12s;
    position: relative;
    z-index: 1;
}
.topnav-iconbtn:hover {
    background: var(--cb-surface-strong);
    color: var(--cb-ink);
}
.topnav-iconbtn:focus-visible {
    outline: 2px solid var(--cb-primary);
    outline-offset: 2px;
}

/* Mobile nav */
.topnav-mobile {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cb-canvas);
    border-top: 1px solid var(--cb-hairline);
    padding: 16px;
    gap: 2px;
    z-index: 99;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.topnav-mobile.open { display: flex; }
.topnav-mobile a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--cb-ink);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 14px 16px;
    border-radius: var(--r-md);
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.topnav-mobile a:hover { background: var(--cb-surface-strong); }
.topnav-mobile a:active { background: var(--cb-surface-strong); }
/* The mobile logout uses a POST form (Django 5.x requires it) but the
   button needs to look identical to the surrounding nav links. */
.topnav-mobile form { margin: 0; padding: 0; }
.topnav-mobile button.topnav-mobile-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    color: var(--cb-ink);
    background: none;
    border: none;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    padding: 14px 16px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.topnav-mobile button.topnav-mobile-logout:hover { background: var(--cb-surface-strong); }
.topnav-mobile button.topnav-mobile-logout:active { background: var(--cb-surface-strong); }

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 6px;
    background: none;
    border: none;
    margin-left: auto;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--cb-ink);
    border-radius: 2px;
    transition: all 0.2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
body.mobile-nav-open { overflow: hidden; }

/* =============================================================
   Layout & Cards
   ============================================================= */
main {
    flex: 1;
    padding: 32px 24px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

/* Generic card / panel — 24px radius, hairline border, no decorative shadow */
.panel {
    background: var(--cb-surface-card);
    border: 1px solid var(--cb-hairline);
    border-radius: var(--r-xl);
    padding: 24px;
    color: var(--cb-ink);
}

/* =============================================================
   Buttons
   ============================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--cb-primary);
    color: var(--cb-on-primary);
    border: 1px solid var(--cb-primary);
    padding: 0 20px;
    height: 44px;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    text-decoration: none;
    line-height: 1;
}
.btn:hover {
    background: var(--cb-primary-active);
    border-color: var(--cb-primary-active);
    color: var(--cb-on-primary);
}
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn.btn-disabled {
    background: var(--cb-primary-disabled);
    border-color: var(--cb-primary-disabled);
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--cb-ink);
    border: 1px solid var(--cb-hairline);
}
.btn-outline:hover {
    background: var(--cb-surface-strong);
    border-color: var(--cb-hairline);
    color: var(--cb-ink);
}

.btn-secondary {
    background: var(--cb-surface-strong);
    color: var(--cb-ink);
    border: 1px solid transparent;
}
.btn-secondary:hover {
    background: var(--cb-hairline);
    color: var(--cb-ink);
}

.btn-text {
    background: transparent;
    color: var(--cb-primary);
    border: none;
    height: auto;
    padding: 4px 8px;
}
.btn-text:hover { background: transparent; color: var(--cb-primary-active); }

.btn-lg {
    height: 56px;
    padding: 0 32px;
    font-size: 16px;
}

/* PRO / featured badge.
   Uses semantic vars that flip with the theme automatically:
   - light mode: ink=dark, canvas=white  -> dark badge with white text
   - dark mode:  ink=white, canvas=dark  -> white badge with dark text
   No theme-specific override needed. */
.pro-badge {
    background: var(--cb-ink);
    color: var(--cb-canvas);
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* =============================================================
   Forms
   ============================================================= */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
    background: var(--cb-canvas);
    color: var(--cb-ink);
    border: 1px solid var(--cb-hairline);
    border-radius: var(--r-md);
    padding: 12px 14px;
    height: 48px;
    font-size: 16px;
    font-weight: 400;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; min-height: 96px; }
input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--cb-primary);
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
}
input::placeholder,
textarea::placeholder { color: var(--cb-muted); }

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--cb-ink);
    margin-bottom: 6px;
}

/* =============================================================
   Tables — used by radar, portfolios, screener
   ============================================================= */
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: left;
    padding: 12px 14px;
    color: var(--cb-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--cb-hairline);
    background: transparent;
}
td {
    padding: 14px 14px;
    color: var(--cb-ink);
    font-size: 14px;
    border-bottom: 1px solid var(--cb-hairline-soft);
}
tbody tr:hover { background: var(--cb-surface-soft); }

/* =============================================================
   Toast system
   ============================================================= */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--cb-on-primary);
    pointer-events: auto;
    animation: toastIn 0.25s ease;
    box-shadow: var(--shadow-pop);
    min-width: 260px;
    background: var(--cb-ink);
}
.toast-success { background: var(--cb-up); }
.toast-error { background: var(--cb-down); }
.toast-info { background: var(--cb-primary); }
.toast-warning { background: var(--cb-warn); color: var(--cb-ink); }
.toast-icon { font-size: 1rem; flex-shrink: 0; opacity: 0.9; }
.toast-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
    font-size: 1.2rem;
    line-height: 1;
    transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; }
.toast.toast-exit { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}
@media (max-width: 600px) {
    .toast-container { right: 12px; left: 12px; max-width: none; }
}

/* =============================================================
   Market status pill
   ============================================================= */
.market-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 28px;
    border-radius: var(--r-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: var(--cb-surface-strong);
    border: 1px solid transparent;
    color: var(--cb-body);
    flex-shrink: 0;
    white-space: nowrap;
}
.market-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}
.market-status-region {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--cb-muted);
    letter-spacing: 0.04em;
}
.market-status-text {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Strip on dashboard hub — small horizontal row of market-status pills */
.market-status-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* =============================================================
   Price flashes — subtle tinted backgrounds (no decorative glow)
   ============================================================= */
@keyframes flash-up {
    0% { background: rgba(5, 177, 105, 0.18); }
    100% { background: transparent; }
}
@keyframes flash-down {
    0% { background: rgba(207, 32, 47, 0.18); }
    100% { background: transparent; }
}
.flash-green { animation: flash-up 0.6s ease-out !important; }
.flash-red { animation: flash-down 0.6s ease-out !important; }

/* Trading semantic helpers — color only, never background fills */
.cb-up,
.mover-delta.pos,
.price-up { color: var(--cb-up); }
.cb-down,
.mover-delta.neg,
.price-down { color: var(--cb-down); }

/* =============================================================
   Loading skeleton
   ============================================================= */
.skeleton {
    background: linear-gradient(90deg,
        var(--cb-surface-strong) 25%,
        var(--cb-hairline) 50%,
        var(--cb-surface-strong) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skel-line { height: 14px; margin: 6px 0; border-radius: var(--r-xs); }
.skel-line.w50 { width: 50%; }
.skel-line.w70 { width: 70%; }
.skel-line.w90 { width: 90%; }
.skel-line.w100 { width: 100%; }
.skel-block { height: 60px; border-radius: var(--r-md); margin: 6px 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .market-dot,
    .skeleton { animation: none !important; }
    .flash-green,
    .flash-red,
    .toast { animation: none !important; }
    * { transition: none !important; }
}

/* =============================================================
   Footer
   ============================================================= */
footer, .site-footer {
    border-top: 1px solid var(--cb-hairline);
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--cb-body);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
footer a, .site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.12s;
}
footer a:hover, .site-footer a:hover { color: var(--brand-teal); }

.footer-links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

/* Footer wordmark image — same theme-aware tint as the topnav logo. */
.footer-logo {
    /* Light mode: tint to Coinbase Blue (#0052ff) */
    filter: brightness(0) saturate(100%) invert(13%) sepia(99%) saturate(7464%) hue-rotate(225deg) brightness(101%) contrast(109%);
}
html[data-theme="dark"] .footer-logo {
    filter: brightness(0) invert(1);
}

/* =============================================================
   Asset glyph — circular plate (Coinbase signature)
   ============================================================= */
.asset-glyph {
    width: 32px;
    height: 32px;
    border-radius: var(--r-full);
    background: var(--cb-surface-strong);
    color: var(--cb-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

/* Section badge pill (e.g. "INSTITUTIONAL") */
.cb-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    background: var(--cb-surface-strong);
    color: var(--cb-ink);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* =============================================================
   Hero bands (light + dark)
   ============================================================= */
.hero-band-dark {
    background: var(--cb-surface-dark);
    color: var(--cb-on-dark);
    padding: var(--s-section) var(--s-lg);
    border-radius: var(--r-xl);
    margin: var(--s-xl) 0;
}
.hero-band-dark h1,
.hero-band-dark h2,
.hero-band-dark h3 { color: var(--cb-on-dark); }
.hero-band-dark p { color: var(--cb-on-dark-soft); }

.hero-band-light {
    background: var(--cb-canvas);
    color: var(--cb-ink);
    padding: var(--s-section) var(--s-lg);
}

/* Product mockup card on dark hero */
.product-card-dark {
    background: var(--cb-surface-dark-elevated);
    color: var(--cb-on-dark);
    border-radius: var(--r-xl);
    padding: var(--s-xl);
}

/* =============================================================
   Asset row — Coinbase signature: hairline-divided list with
   circular icon plate + monospace tabular price + semantic
   colored change cell. Apply to <tr> or <div role="row">.

   Markup:
     <div class="asset-row">
       <span class="asset-glyph">BT</span>
       <div class="asset-id">
         <div class="asset-id-name">Bitcoin</div>
         <div class="asset-id-ticker">BTC</div>
       </div>
       <span class="asset-price">$67,432.18</span>
       <span class="asset-change up">+2.4%</span>
     </div>
   ============================================================= */
.asset-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: var(--s-base);
    padding: var(--s-base) 0;
    border-bottom: 1px solid var(--cb-hairline-soft);
    color: var(--cb-ink);
}
.asset-row:last-child { border-bottom: none; }
.asset-row:hover { background: var(--cb-surface-soft); }
.asset-id-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--cb-ink);
    line-height: 1.33;
}
.asset-id-ticker {
    font-size: 13px;
    color: var(--cb-muted);
    line-height: 1.4;
}
.asset-price {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--cb-ink);
    text-align: right;
}
.asset-change {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    min-width: 72px;
    text-align: right;
}
.asset-change.up,
.asset-change.pos { color: var(--cb-up); }
.asset-change.down,
.asset-change.neg { color: var(--cb-down); }

@media (max-width: 600px) {
    /* Drop the change column on mobile per Coinbase responsive spec */
    .asset-row { grid-template-columns: auto 1fr auto; }
    .asset-change { display: none; }
}

/* =============================================================
   Search input — pill style for inline search inputs.
   Apply .search-pill to <input> wrapper or directly to input.
   ============================================================= */
.search-pill,
input.search-pill {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 40px;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    background: var(--cb-surface-strong);
    color: var(--cb-ink);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: background 0.15s, border-color 0.15s;
}
input.search-pill::placeholder { color: var(--cb-muted); }
input.search-pill:focus {
    background: var(--cb-canvas);
    border-color: var(--cb-primary);
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
}

/* Search wrapper to position the leading icon */
.search-pill-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}
.search-pill-wrap > .search-pill-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cb-muted);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    z-index: 1;
}

/* =============================================================
   Visually hidden (a11y)
   ============================================================= */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 1024px) {
    main { padding: 24px 20px; }
}
@media (max-width: 1100px) {
    .topnav-links { display: none; }
    .hamburger { display: flex; }
    main { padding: 20px 16px; }
    .topnav-inner { flex-wrap: nowrap; }
}
@media (max-width: 600px) {
    .topnav { padding: 0 12px; height: 56px; }
    .topnav-inner { gap: 4px; }
    .topnav-mobile { top: 56px; }
    .topnav-logo span { display: none; }
    .topnav-logo { padding: 4px; }
    .topnav-search { display: block; flex: 1; margin: 0 4px; min-width: 0; }
    .topnav .topnav-search input { height: 36px; padding: 0 12px 0 32px; font-size: 13px; }
    .topnav-search-icon { left: 10px; }
    main { padding: 16px 12px; }
    footer {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 24px 16px;
    }
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
}
