/* Live design tokens taken from stoxcredit-app-redesign.html.
   These override the old mixed palettes in the actual application DOM. */
:root {
  --ref-bg:#f3efe6; --ref-raised:#fcfbf7; --ref-sunken:#e9e4d8;
  --ref-border:#e2ddcf; --ref-border-strong:#cfc8b5;
  --ref-text:#17140f; --ref-muted:#59544a; --ref-subtle:#938d7e;
  --ref-accent:#0b42e8; --ref-accent-soft:#e8edff;
  --ref-positive:#1a8c4a; --ref-negative:#c43a3a;
  --ref-shadow:0 1px 2px rgba(23,20,15,.05),0 10px 30px -14px rgba(23,20,15,.16);
  --bg:var(--ref-bg); --p:var(--ref-raised); --line:var(--ref-border);
  --ink:var(--ref-text); --muted:var(--ref-muted); --lime:var(--ref-accent);
  --sc-bg:var(--ref-bg); --sc-surface:var(--ref-raised); --sc-raised:var(--ref-sunken);
  --sc-border:var(--ref-border); --sc-text:var(--ref-text); --sc-muted:var(--ref-muted);
  --sc-accent:var(--ref-accent); --sc-brand:var(--ref-accent);
  --dash-bg:var(--ref-bg); --dash-surface:var(--ref-raised); --dash-border:var(--ref-border);
  --dash-text:var(--ref-text); --dash-muted:var(--ref-muted); --dash-accent:var(--ref-accent);
}
html[data-theme="dark"] {
  --ref-bg:#0d0e11; --ref-raised:#16181d; --ref-sunken:#1d2026;
  --ref-border:#2a2d35; --ref-border-strong:#3a3e48;
  --ref-text:#f2f0ea; --ref-muted:#a7a79e; --ref-subtle:#6f6f69;
  --ref-accent:#4d7bff; --ref-accent-soft:#1a2440;
  --ref-positive:#3fcf7b; --ref-negative:#f06a6a;
  --ref-shadow:0 1px 2px rgba(0,0,0,.5),0 10px 30px -14px rgba(0,0,0,.7);
}
html body.app-mode,
html body.app-mode #appView,
html body.app-mode #dashboardView,
html body.app-mode #perpsView,
html body.app-mode #giftView { background: var(--ref-bg) !important; color: var(--ref-text); }
html body.app-mode .site-header {
  height: 64px;
  min-height: 64px;
  padding-inline: max(24px, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--ref-bg) 85%, transparent);
  border-bottom: 1px solid var(--ref-border);
  backdrop-filter: blur(14px);
}
html body.app-mode .site-header .brand-link { gap: 10px; font-size: 18px; }
html body.app-mode .site-header .brand-mark,
html body.app-mode .site-header .brand-logo { width: 30px; height: 30px; border-radius: 8px; }
html body.app-mode .site-header .site-nav { gap: 4px; }
html body.app-mode .site-header .site-nav a { padding: 8px 12px; border-radius: 8px; border: 0 !important; font-size: 14px; font-weight: 500; color: var(--ref-muted); }
html body.app-mode .site-header .site-nav a[aria-current="page"],
html body.app-mode .site-header .site-nav a.active { background: var(--ref-sunken) !important; color: var(--ref-text); }
html body.app-mode .site-header .site-nav a:hover { color: var(--ref-text); }
html body.app-mode .site-header .header-actions { gap: 8px; }
html body.app-mode .site-header .network-badge { border: 1px solid var(--ref-border-strong); border-radius: 999px; background: var(--ref-raised); color: var(--ref-text); }
html body.app-mode .site-header #wallet { border: 0 !important; border-radius: 999px; min-height: 38px; background: linear-gradient(135deg,#1a52ff,#0b32c8) !important; color: #fff !important; padding-inline: 18px; font-weight: 600; }
html[data-theme="dark"] body.app-mode .site-header #wallet { background: linear-gradient(135deg,#5b84ff,#3257e6) !important; color:#0a0c10 !important; }
html body.app-mode .site-header .language-control { display: none; }
html body.app-mode .site-header .site-nav a[data-route="learn"],
html body.app-mode #scrollRouteNav a[data-quick-route="learn"],
html body.app-mode #homeView a[href="#/learn"] { display: none !important; }
html body.app-mode .site-footer a[href="#/learn"] { display:none !important; }

/* Native Markets: keep the live table and controls, use the source card colors. */
html[data-nav-route="market"] body.app-mode:not(.stock-detail-mode) #appView,
html[data-nav-route="market"] body.app-mode.stock-detail-mode #appView { max-width: 1180px; margin-inline: auto; }
html[data-nav-route="market"] body.app-mode:not(.stock-detail-mode) #marketlist table.table thead th { background: var(--ref-raised) !important; border-color: var(--ref-border) !important; }
html[data-nav-route="market"] body.app-mode:not(.stock-detail-mode) #marketlist { border-radius: 26px !important; }
html[data-nav-route="market"] body.app-mode:not(.stock-detail-mode) #marketlist table.table tbody tr:hover { background: var(--ref-sunken); }

/* Dashboard: source heading, value card, allocation and tables on real wallet data. */
html[data-site-route="dashboard"] body.app-mode #dashboardView.dashboard-shell { max-width:1180px; padding:42px 24px 64px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-heading { display:flex; align-items:start; justify-content:space-between; border:0; margin:0 0 20px; padding:0; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-heading h1 { font:500 clamp(30px,4vw,40px)/1.08 Fraunces,Georgia,serif; letter-spacing:-.025em; color:var(--ref-text); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-heading p { margin:7px 0 0; color:var(--ref-muted); font-size:14px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect { display:block; max-width:none; margin:0; padding:24px; border:1px solid var(--ref-border); border-radius:18px; background:var(--ref-raised); box-shadow:var(--ref-shadow); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect[hidden] { display:none !important; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect::after { display:none; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect h2 { font:500 28px/1.2 Fraunces,Georgia,serif; color:var(--ref-text); margin:0 0 8px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect p { margin:0 0 18px; max-width:650px; color:var(--ref-muted); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect button { border:0; border-radius:999px; background:linear-gradient(135deg,#1a52ff,#0b32c8); color:#fff; min-height:46px; padding-inline:24px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect button { display:flex; width:fit-content; margin:0 0 12px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect-markets { display:flex; width:fit-content; margin:0 !important; color:var(--ref-accent); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-balances { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px 24px; margin-top:0; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-section-heading { grid-column:1/-1; }
html[data-site-route="dashboard"] body.app-mode #dashboardView #dashboardBalancesTitle { display:none; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-wallet-total { grid-column:1; margin:0; padding:24px; border:1px solid var(--ref-border); border-radius:18px; background:var(--ref-raised); box-shadow:var(--ref-shadow); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-wallet-total span { color:var(--ref-subtle); text-transform:uppercase; letter-spacing:.08em; font-size:12px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-wallet-total strong { display:block; margin:16px 0 6px; font:600 34px/1.1 'JetBrains Mono',monospace; color:var(--ref-text); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut { grid-column:2; display:flex; align-items:center; gap:20px; min-height:200px; padding:20px; border:1px solid var(--ref-border); border-radius:18px; background:var(--ref-raised); box-shadow:var(--ref-shadow); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-ring { flex:none; width:150px; height:150px; padding:19px; border-radius:50%; background:var(--ref-sunken); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-center { display:flex; height:100%; flex-direction:column; align-items:center; justify-content:center; border-radius:50%; background:var(--ref-raised); text-align:center; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-center span { color:var(--ref-subtle); font-size:11px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-center strong { color:var(--ref-text); font:600 17px 'JetBrains Mono',monospace; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-legend { flex:1; min-width:0; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-item { display:grid; grid-template-columns:8px minmax(0,1fr) auto auto; align-items:center; gap:7px; padding:5px 0; border-bottom:1px solid var(--ref-border); font-size:12px; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-item i { width:8px; height:8px; border-radius:50%; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-item span:nth-child(3) { color:var(--ref-muted); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut-item strong { font:500 12px 'JetBrains Mono',monospace; }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-table-wrap { grid-column:1/-1; border:1px solid var(--ref-border); border-radius:18px; background:var(--ref-raised); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-box { border:1px solid var(--ref-border); border-radius:18px; background:var(--ref-raised); box-shadow:var(--ref-shadow); }
html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-summary-card { border:1px solid var(--ref-border); border-radius:12px; background:var(--ref-bg); }
@media(max-width:760px) {
  html[data-site-route="dashboard"] body.app-mode #dashboardView.dashboard-shell { padding:24px 16px 40px; }
  html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-balances { grid-template-columns:1fr; }
  html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-wallet-total,
  html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut { grid-column:1; }
  html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-donut { flex-wrap:wrap; }
  html[data-site-route="dashboard"] body.app-mode #dashboardView .dashboard-connect-markets { margin:12px 0 0; }
}
@media (max-width: 900px) {
  html body.app-mode .site-header { padding-inline: 16px; height: auto; min-height: 64px; }
}

/* Keep navigation readable when the header wraps into two rows. */
@media (max-width: 900px) {
  html body.app-mode .site-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 12px;
    height: auto !important;
    padding: 10px 16px 0 !important;
  }
  html body.app-mode .site-header .header-left { display: contents !important; }
  html body.app-mode .site-header .brand-link {
    grid-column: 1; grid-row: 1; justify-self: start; min-width: 0;
  }
  html body.app-mode .site-header .header-actions {
    grid-column: 2; grid-row: 1; justify-self: end;
    flex: 0 0 auto !important; width: auto !important; margin: 0 !important;
  }
  html body.app-mode .site-header .site-nav {
    grid-column: 1 / -1; grid-row: 2;
    display: flex !important; justify-self: stretch !important;
    justify-content: flex-start !important; align-items: center;
    width: 100% !important; max-width: 100%; min-width: 0;
    gap: 4px !important; padding: 0 !important;
    overflow-x: auto !important; overflow-y: hidden !important;
    white-space: nowrap; scrollbar-width: none;
    border: 0 !important; border-top: 1px solid var(--ref-border) !important;
    border-radius: 0 !important; background: transparent !important;
    box-shadow: none !important;
  }
  html body.app-mode .site-header .site-nav::-webkit-scrollbar { display: none; }
  html body.app-mode .site-header .site-nav a {
    flex: 0 0 auto; min-height: 44px;
    padding: 10px 12px !important;
    border: 0 !important; border-bottom: 2px solid transparent !important;
    border-radius: 0 !important; background: transparent !important;
  }
  html body.app-mode .site-header .site-nav a[aria-current="page"],
  html body.app-mode .site-header .site-nav a.active {
    color: var(--ref-text) !important;
    border-bottom-color: var(--ref-accent) !important;
    background: transparent !important;
  }
}
@media (max-width: 600px) {
  html body.app-mode .site-header { grid-template-rows: auto auto auto; }
  html body.app-mode .site-header .header-actions {
    grid-column: 1 / -1; grid-row: 2;
    justify-self: stretch; justify-content: flex-end;
    width: 100% !important;
  }
  html body.app-mode .site-header .site-nav { grid-row: 3; }
}
