/* Approved visual direction (v1). Tokens and type only, applied over the existing markup. Loaded last. */

:root,
html body,
html body.app-mode {
  --sc-canvas: #F4F3EF;
  --sc-surface: #FFFFFF;
  --sc-elevated: #ECEBE6;
  --sc-border: #D8D6CE;
  --sc-ink: #0F1417;
  --sc-ink-2: #4A5459;
  --sc-accent: #2456E0;
  --sc-accent-ink: #FFFFFF;
  --sc-success: #1E7A4C;
  --sc-warning: #8A5A12;
  --sc-danger: #A12F2F;
  --sc-font: Inter, "Segoe UI", system-ui, sans-serif;
  --sc-rule: 1px solid var(--sc-border);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]),
  html:not([data-theme="light"]) body,
  html:not([data-theme="light"]) body.app-mode {
    --sc-canvas: #0E1215;
    --sc-surface: #161B1F;
    --sc-elevated: #1D2328;
    --sc-border: #2C343A;
    --sc-ink: #F0F2F2;
    --sc-ink-2: #AEB8BC;
    --sc-accent: #8FB0FF;
    --sc-accent-ink: #0E1215;
    --sc-success: #7FC9A0;
    --sc-warning: #E2B46E;
    --sc-danger: #E59A96;
  }
}

:root[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] body.app-mode {
  --sc-canvas: #0E1215;
  --sc-surface: #161B1F;
  --sc-elevated: #1D2328;
  --sc-border: #2C343A;
  --sc-ink: #F0F2F2;
  --sc-ink-2: #AEB8BC;
  --sc-accent: #8FB0FF;
  --sc-accent-ink: #0E1215;
  --sc-success: #7FC9A0;
  --sc-warning: #E2B46E;
  --sc-danger: #E59A96;
}

html body,
html body button,
html body input,
html body select {
  font-family: var(--sc-font) !important;
}

html body {
  background: var(--sc-canvas) !important;
  color: var(--sc-ink) !important;
}

html body h1 {
  font-size: 40px !important;
  font-weight: 650 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.1 !important;
}

@media (max-width: 600px) {
  html body h1 {
    font-size: 32px !important;
  }
}

html body .home-kicker,
html body .kicker,
html body .section-label {
  color: var(--sc-accent) !important;
  font-weight: 600 !important;
}

html body .home-primary,
html body .home-calculator-action,
html body .wallet,
html body #dashboardConnectButton,
html body .app-mode .header-actions .wallet,
html body .app-mode .home-primary {
  background: var(--sc-accent) !important;
  color: var(--sc-accent-ink) !important;
}

html body .home-primary span,
html body .home-calculator-action span,
html body #wallet,
html body #wallet *,
html body #homeCalcAction {
  color: var(--sc-accent-ink) !important;
}

html body #wallet {
  background: var(--sc-accent) !important;
}

html body .home-secondary,
html body .home-borrow-link,
html body .home-market-tape-all,
html body .home-lending-link {
  color: var(--sc-accent) !important;
}

html body .home-stat strong,
html body .home-stat-strip strong {
  font-weight: 650 !important;
}

html body .home-stat-strip,
html body .home-market-tape,
html body .home-lead > .home-sheet-head {
  border-color: var(--sc-border) !important;
}

html body .home-stat-strip strong,
html body .home-stat strong,
html body .market-metrics strong {
  font-variant-numeric: tabular-nums;
}

html body .home-risk,
html body .home-lending,
html body .home-risk > *,
html body .home-lending > * {
  border-color: var(--sc-border) !important;
}

html body .site-header,
html body header {
  background: var(--sc-canvas) !important;
  border-bottom-color: var(--sc-border) !important;
}

html body .site-nav a.active {
  box-shadow: inset 0 -2px 0 var(--sc-accent) !important;
}

html body .home-loan-plate {
  background: var(--sc-surface) !important;
  border-color: var(--sc-border) !important;
}

html body .home-caution {
  border-left-color: var(--sc-warning) !important;
}

html body .home-stat-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: start;
}

html body .home-stat-strip .home-stat strong,
html body .home-stat-strip .home-stat-tvl strong {
  font-size: 24px !important;
  line-height: 1.2 !important;
  letter-spacing: -0.01em;
}

html body .home-stat-strip .home-stat small {
  font-size: 12px !important;
}

@media (max-width: 960px) {
  html body .home-stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  html body .home-stat-strip {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

html body .home-stat-strip .home-stat-heading {
  grid-column: 1 / -1;
}

html body .home-how {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 56px 0 0;
  padding-bottom: 8px;
}

html body .home-how-head {
  grid-column: 1 / -1;
  margin-bottom: 24px;
}

html body .home-how-head h2 {
  font-size: 24px !important;
  font-weight: 650 !important;
  margin: 0 !important;
  letter-spacing: -0.01em !important;
}

html body .home-how article {
  border-top: 2px solid var(--sc-ink);
  padding: 28px 28px 0 0;
  color: var(--sc-ink);
}

html body .home-how article + article {
  padding-left: 28px;
}

html body .home-how svg {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 8px 0 20px;
  color: var(--sc-ink);
}

html body .home-how h3 {
  font-size: 16px !important;
  font-weight: 600 !important;
  margin: 0 0 8px !important;
}

html body .home-how p {
  margin: 0;
  color: var(--sc-ink-2);
  line-height: 1.6;
}

/* Floating route nav: calm enter and exit, one icon system, light and dark */
html body .scroll-route-nav {
  background: var(--sc-surface) !important;
  border: 1px solid var(--sc-border) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 24px rgba(15, 20, 23, 0.08) !important;
  transform-origin: 50% 0;
  transform: translate(-50%, -8px) scale(0.98) !important;
  opacity: 0 !important;
  visibility: hidden;
  transition:
    transform 180ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 140ms ease-out,
    visibility 0s linear 180ms !important;
}

html body .scroll-route-nav.is-visible {
  transform: translate(-50%, 0) scale(1) !important;
  opacity: 1 !important;
  visibility: visible;
  transition:
    transform 260ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 200ms ease-out,
    visibility 0s !important;
}

html body .scroll-route-nav a,
html body .scroll-route-nav .scroll-wallet-button {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease-out, transform 220ms cubic-bezier(0.23, 1, 0.32, 1), background-color 150ms ease, color 150ms ease !important;
}

html body .scroll-route-nav.is-visible a,
html body .scroll-route-nav.is-visible .scroll-wallet-button {
  opacity: 1;
  transform: translateY(0);
}

html body .scroll-route-nav.is-visible a:nth-child(2) { transition-delay: 30ms, 30ms, 0s, 0s !important; }
html body .scroll-route-nav.is-visible a:nth-child(3) { transition-delay: 60ms, 60ms, 0s, 0s !important; }
html body .scroll-route-nav.is-visible a:nth-child(4) { transition-delay: 90ms, 90ms, 0s, 0s !important; }
html body .scroll-route-nav.is-visible .scroll-wallet-button { transition-delay: 120ms, 120ms, 0s, 0s !important; }

html body .scroll-route-nav a {
  color: var(--sc-ink-2) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: -0.005em;
}

html body .scroll-route-nav .scroll-wallet-button {
  font-size: 13px !important;
  font-weight: 600 !important;
}

html body .scroll-route-nav .scroll-wallet-label {
  color: inherit !important;
}

html body .scroll-route-nav a:hover {
  color: var(--sc-ink) !important;
  background: var(--sc-elevated) !important;
}

html body .scroll-route-nav a[aria-current="page"] {
  color: var(--sc-ink) !important;
  background: var(--sc-elevated) !important;
  font-weight: 600;
}

html body .scroll-route-nav svg {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.6 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

html body .scroll-route-nav svg circle {
  fill: currentColor !important;
  stroke: none !important;
}

html body .scroll-route-nav .scroll-route-brand {
  border-right: 1px solid var(--sc-border) !important;
}

html body .scroll-route-nav .scroll-wallet-button {
  flex: 0 0 auto !important;
  min-width: max-content !important;
  max-width: none !important;
  width: auto !important;
  padding: 0 14px !important;
  background: var(--sc-ink) !important;
  color: var(--sc-canvas) !important;
  border: 1px solid var(--sc-ink) !important;
}

html body .scroll-route-nav .scroll-wallet-button:hover {
  background: var(--sc-accent) !important;
  border-color: var(--sc-accent) !important;
  color: var(--sc-accent-ink) !important;
}

html body .scroll-route-nav .scroll-wallet-button.is-connected {
  background: var(--sc-surface) !important;
  color: var(--sc-ink) !important;
  border: 1px solid var(--sc-border) !important;
}

html body .scroll-route-nav .scroll-wallet-dot {
  background: var(--sc-success) !important;
}

html body .scroll-route-nav .scroll-wallet-button:disabled {
  opacity: 1 !important;
  cursor: progress;
}

html body header .header-actions {
  gap: 10px !important;
  align-items: center;
}

html body header .header-actions > .theme-toggle {
  margin-left: 8px !important;
  margin-right: 8px !important;
}

html body .theme-toggle {
  margin: 0 !important;
  flex: 0 0 36px;
  font-size: 0 !important;
  color: transparent !important;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--sc-border) !important;
  border-radius: 4px !important;
  background: var(--sc-surface) !important;
}

html body .theme-toggle::before {
  content: "";
  width: 18px;
  height: 18px;
  background-color: #4A5459 !important;
  -webkit-mask: var(--sc-sun-icon) center / contain no-repeat;
  mask: var(--sc-sun-icon) center / contain no-repeat;
}

html body .theme-toggle::after,
html body .theme-toggle:hover::after {
  content: none !important;
  display: none !important;
}

html body .theme-toggle:hover::before {
  background-color: #0F1417 !important;
}

html[data-theme="dark"] body .theme-toggle::before,
html body[data-theme="dark"] .theme-toggle::before {
  background-color: #AEB8BC !important;
  -webkit-mask: var(--sc-moon-icon) center / contain no-repeat;
  mask: var(--sc-moon-icon) center / contain no-repeat;
}

html[data-theme="dark"] body .theme-toggle:hover::before {
  background-color: #F0F2F2 !important;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body .theme-toggle::before {
    background-color: #AEB8BC !important;
    -webkit-mask: var(--sc-moon-icon) center / contain no-repeat;
    mask: var(--sc-moon-icon) center / contain no-repeat;
  }
}

html body {
  --sc-moon-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/></svg>");
  --sc-sun-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='12' cy='12' r='4' fill='none' stroke='black' stroke-width='2'/><path d='M12 2.5v2.2M12 19.3v2.2M2.5 12h2.2M19.3 12h2.2M5.3 5.3l1.6 1.6M17.1 17.1l1.6 1.6M5.3 18.7l1.6-1.6M17.1 6.9l1.6-1.6'/></svg>");
}

@media (prefers-reduced-motion: reduce) {
  html body .scroll-route-nav,
  html body .scroll-route-nav a,
  html body .scroll-route-nav .scroll-wallet-button {
    transition: opacity 120ms linear !important;
    transform: translate(-50%, 0) !important;
  }
  html body .scroll-route-nav a,
  html body .scroll-route-nav .scroll-wallet-button {
    transform: none !important;
  }
}

html body .pending-markets {
  display: none !important;
}

html body .dashboard-summary {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  padding: 0 !important;
  margin-bottom: 40px;
  background: transparent !important;
  border: 0 !important;
  border-top: 1px solid var(--sc-border) !important;
  border-bottom: 1px solid var(--sc-border) !important;
  border-radius: 0 !important;
}

html body .dashboard-summary-card {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 20px 20px 20px 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .dashboard-summary-card + .dashboard-summary-card {
  padding-left: 20px !important;
  border-left: 1px solid var(--sc-border) !important;
}

html body .dashboard-summary-card > span {
  font-size: 13px !important;
  color: var(--sc-ink-2) !important;
}

html body .dashboard-summary-card > strong {
  font-size: 26px !important;
  font-weight: 650 !important;
  font-variant-numeric: tabular-nums;
  color: var(--sc-ink) !important;
  line-height: 1.2;
}

html body .dashboard-summary-card > small {
  font-size: 12px !important;
  color: var(--sc-ink-2) !important;
}

html body .dashboard-table {
  display: table !important;
  width: 100%;
  border-collapse: collapse;
}

html body .dashboard-table thead {
  display: table-header-group !important;
}

html body .dashboard-table tbody {
  display: table-row-group !important;
}

html body .dashboard-table tr {
  display: table-row !important;
}

html body .dashboard-table td {
  display: table-cell !important;
  padding: 14px 12px !important;
  border-bottom: 1px solid var(--sc-border) !important;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--sc-ink) !important;
  vertical-align: middle;
}

html body .dashboard-table td:first-child {
  text-align: left;
  font-weight: 600;
}

html body .dashboard-table td button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 4px !important;
  background: transparent !important;
  color: var(--sc-ink) !important;
  border: 1px solid var(--sc-border) !important;
  font-weight: 600 !important;
}

html body .dashboard-table td button:hover {
  background: var(--sc-ink) !important;
  color: var(--sc-canvas) !important;
  border-color: var(--sc-ink) !important;
}

html body .dashboard-table thead th {
  display: table-cell !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--sc-ink-2) !important;
  text-align: right;
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--sc-ink) !important;
}

html body .dashboard-table thead th:first-child {
  text-align: left;
}

html body #form .field,
html body #form .position-metrics,
html body #form .position-summary {
  border: 1px solid var(--sc-border);
  border-radius: 8px;
  background: var(--sc-surface);
  padding: 16px 18px;
  margin-bottom: 12px;
}

html body #form select.market-choice {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0 40px 0 14px;
  border: 1px solid var(--sc-border) !important;
  border-radius: 4px !important;
  background-color: var(--sc-surface) !important;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5459' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>") !important;
  background-position: right 14px center !important;
  background-size: 16px 16px !important;
  background-repeat: no-repeat !important;
  color: var(--sc-ink) !important;
  font-size: 15px !important;
  font-weight: 500 !important;
}

html body #form select.market-choice option {
  background: var(--sc-surface);
  color: var(--sc-ink);
  padding: 10px 14px;
}

html body #form select.market-choice:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

html body #form label.market-choice-label {
  font-size: 14px !important;
  color: var(--sc-ink-2) !important;
  font-weight: 500 !important;
  margin-bottom: 8px;
  display: block;
}

html body #form .field:focus-within {
  border-color: var(--sc-accent);
}

html body #form .field label {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--sc-ink-2) !important;
  display: block;
  margin-bottom: 8px;
}

html body #form .amount {
  display: flex;
  align-items: center;
  gap: 12px;
}

html body #form .amount input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  background: transparent !important;
  font-size: 36px !important;
  font-weight: 600 !important;
  color: var(--sc-ink) !important;
  padding: 0 !important;
  font-variant-numeric: tabular-nums;
}

html body #form .max-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 4px !important;
  background: var(--sc-elevated) !important;
  color: var(--sc-ink) !important;
  border: 1px solid var(--sc-border) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

html body #form .max-btn:disabled {
  opacity: 0.5;
}

html body #form .position-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

html body #form .position-metrics span,
html body #form .position-summary span,
html body #form .position-summary small {
  font-size: 13px !important;
  color: var(--sc-ink-2) !important;
}

html body #form .position-metrics b,
html body #form .position-summary b {
  font-size: 15px !important;
  font-variant-numeric: tabular-nums;
  color: var(--sc-ink) !important;
}

/* Repay and withdraw balances need the full card width for readable values. */
html body .layout > aside #form:has(:is(#repayAmount, #withdrawAmount)) > .position-metrics {
  display: block !important;
  padding: 4px 16px !important;
}

html body .layout > aside #form:has(:is(#repayAmount, #withdrawAmount)) > .position-metrics > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 10px 0;
}

html body .layout > aside #form:has(:is(#repayAmount, #withdrawAmount)) > .position-metrics > div + div {
  border-top: 1px solid var(--sc-border);
}

html body .layout > aside #form:has(:is(#repayAmount, #withdrawAmount)) > .position-metrics span {
  min-width: 0;
  line-height: 1.35;
}

html body .layout > aside #form:has(:is(#repayAmount, #withdrawAmount)) > .position-metrics b {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}

html body #form .position-summary > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--sc-border);
}

html body #form .position-summary > div:first-of-type {
  border-top: 0;
}

html body #form .notice {
  font-size: 13px !important;
  color: var(--sc-ink-2) !important;
  line-height: 1.5;
}

html body #form button.primary {
  width: 100%;
  min-height: 48px;
  border-radius: 8px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
}

html body .stock-brand-strategy-official {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
}

html body .stock-brand-strategy-official img.company-logo {
  width: 40px !important;
  height: 40px !important;
  max-width: none !important;
  object-fit: contain;
}

/* Markets: rules over boxes, one accent, tabular figures */
html body .app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

html body .app-heading {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--sc-border);
  margin-bottom: 0;
}

html body .layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 320px;
  gap: 0;
  margin-top: 0;
  align-items: start;
}

html body .layout > section.panel,
html body .layout > article,
html body .layout > aside > section.panel {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 24px 0 !important;
}

html body .layout > section.panel {
  padding-right: 32px !important;
}

html body .layout > article {
  padding: 24px 32px !important;
  border-left: 1px solid var(--sc-border);
  border-right: 1px solid var(--sc-border);
  min-height: 100%;
}

html body .layout > aside {
  padding-left: 32px;
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
}

html body .layout > aside > section.panel {
  border-top: 1px solid var(--sc-border) !important;
  padding-top: 20px !important;
}

html body .layout > aside .explore-switch,
html body .layout > aside [role="tablist"] {
  width: 100%;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  background: transparent !important;
  border-bottom: 1px solid var(--sc-border);
  border-radius: 0 !important;
}

html body .layout > aside .tabs {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

html body .layout > aside button[role="tab"],
html body .layout > aside .tabs button,
html body .layout > aside .action-tabs button {
  min-height: 44px;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--sc-ink-2) !important;
  font-weight: 600 !important;
}

html body .layout > aside button[role="tab"][aria-selected="true"],
html body .layout > aside .tabs button.on,
html body .layout > aside .action-tabs button.on {
  color: var(--sc-ink) !important;
  border-bottom-color: var(--sc-ink) !important;
}

html body .layout > aside input {
  min-height: 48px;
  border: 1px solid var(--sc-border) !important;
  border-radius: 8px !important;
  background: var(--sc-surface) !important;
  color: var(--sc-ink) !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums;
  padding: 0 14px !important;
}

html body .layout > aside input:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

html body .layout > aside .max-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 4px !important;
  background: var(--sc-elevated) !important;
  color: var(--sc-ink) !important;
  border: 1px solid var(--sc-border) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

html body .layout > aside button.primary {
  width: 100%;
  min-height: 52px;
  border-radius: 8px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  background: var(--sc-accent) !important;
  color: var(--sc-accent-ink) !important;
  border: 1px solid transparent !important;
}

html body .layout > aside button.primary:hover {
  background: var(--sc-accent) !important;
  color: var(--sc-accent-ink) !important;
  filter: brightness(1.06);
}

html body .layout > aside button.primary:disabled {
  background: var(--sc-elevated) !important;
  color: var(--sc-ink-2) !important;
  border-color: var(--sc-border) !important;
  opacity: 1;
}

html body .layout > aside #marketLivePreview,
html body .layout > aside details.market-info,
html body .layout > aside section.panel > .ph,
html body .layout > aside details.projection-details {
  display: none !important;
}

html body .layout > aside #form > .position-metrics:has(#borrowDebt) {
  display: none !important;
}

html body .layout > aside #form > .field {
  padding: 10px 14px !important;
  margin-bottom: 0 !important;
}

html body .layout > aside #form > .field > label {
  margin-bottom: 4px !important;
}

html body .layout > aside #form > .field {
  border-radius: 12px !important;
  padding: 16px !important;
}

html body .layout > aside #form > .field .amount input {
  font-size: 32px !important;
  font-weight: 500 !important;
}

html body .layout > aside .explore-switch,
html body .layout > aside [role="tablist"] {
  display: inline-flex !important;
  width: auto !important;
  grid-template-columns: none !important;
  background: var(--sc-elevated) !important;
  border: 0 !important;
  border-radius: 8px !important;
  padding: 4px !important;
  gap: 4px;
  margin-bottom: 16px;
}

html body .layout > aside [role="tablist"] button,
html body .layout > aside .tabs button {
  min-height: 36px !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-bottom: 0 !important;
  border-radius: 6px !important;
  font-size: 14px !important;
}

html body .layout > aside [role="tablist"] button[aria-selected="true"],
html body .layout > aside .tabs button.on {
  background: var(--sc-surface) !important;
  color: var(--sc-ink) !important;
  box-shadow: 0 0 0 1px var(--sc-border);
}

html body .layout > aside #form > .field .balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px !important;
  color: var(--sc-ink-2) !important;
  margin-top: 4px;
}

html body #overviewMount .overview-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0 !important;
}

html body #overviewMount .overview-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--sc-border);
}

html body #overviewMount .overview-stats > div > span {
  font-size: 14px !important;
}

html body #overviewMount .overview-stats > div > strong {
  font-size: 18px !important;
}

html body #overviewMount .overview-stats > div > small {
  width: 100%;
}

html body .layout > aside #form .amount {
  min-height: 40px;
  gap: 8px;
}

html body .layout > aside #form .estimate {
  padding: 12px 14px !important;
}

html body .layout > aside #form .amount input {
  font-size: 22px !important;
}

html body .layout > aside #form .amount {
  min-height: 44px;
}

html body .layout > aside details.projection-details > summary {
  min-height: 40px;
}

html body .layout > aside #form {
  display: grid;
  gap: 12px;
}

html body .layout > aside details.projection-details {
  border: 1px solid var(--sc-border);
  border-radius: 8px;
  background: var(--sc-surface);
  padding: 0 16px;
  margin-top: 16px;
}

html body .layout > aside details.projection-details > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--sc-ink) !important;
  cursor: pointer;
  list-style: none;
}

html body .layout > aside details.projection-details > summary::-webkit-details-marker {
  display: none;
}

html body .layout > aside details.projection-details > summary::after {
  content: "+";
  color: var(--sc-ink-2);
  font-weight: 400;
  font-size: 18px;
}

html body .layout > aside details.projection-details[open] > summary::after {
  content: "−";
}

html body .layout > aside details.projection-details > summary + * ,
html body .layout > aside details.projection-details > div {
  border-top: 1px solid var(--sc-border);
  padding: 12px 0;
}

html body .layout > aside details.projection-details > div > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px !important;
}

html body .layout > aside details.projection-details span,
html body .layout > aside details.projection-details small {
  color: var(--sc-ink-2) !important;
  font-size: 13px !important;
}

html body .layout > aside details.projection-details b,
html body .layout > aside details.projection-details strong {
  color: var(--sc-ink) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 600 !important;
}

html body #overviewMount .market-overview {
  border: 0 !important;
  border-top: 1px solid var(--sc-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 24px 0 !important;
  box-shadow: none !important;
}

html body #overviewMount .market-identity h1 {
  font-size: 32px !important;
  font-weight: 650 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.15 !important;
}

html body #overviewMount .token-stack .coin {
  border: 1px solid var(--sc-border) !important;
  background: var(--sc-surface) !important;
}

html body #overviewMount .lltv-pill {
  border: 1px solid var(--sc-border) !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: var(--sc-ink) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 6px 10px;
}

html body #overviewMount .overview-stats {
  border-top: 1px solid var(--sc-border) !important;
  border-bottom: 1px solid var(--sc-border) !important;
}

html body .layout > aside .loan-preview,
html body .layout > aside .loan-box,
html body .layout > aside .preview-box {
  border: 1px solid var(--sc-border) !important;
  border-radius: 8px !important;
  background: var(--sc-surface) !important;
  box-shadow: none !important;
}

html body .ph h2,
html body .layout h2 {
  font-size: 20px !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
  color: var(--sc-ink) !important;
}

html body .count {
  color: var(--sc-ink-2) !important;
  font-size: 13px !important;
  font-variant-numeric: tabular-nums;
}

html body .explore-switch {
  display: inline-flex !important;
  background: var(--sc-elevated) !important;
  border: 0 !important;
  border-radius: 8px !important;
  padding: 4px !important;
  gap: 4px;
}

html body .explore-switch button {
  min-height: 36px !important;
  padding: 0 16px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: var(--sc-ink-2) !important;
  font-weight: 600 !important;
}

html body .explore-switch button.on,
html body .explore-switch button[aria-pressed="true"] {
  background: var(--sc-surface) !important;
  color: var(--sc-ink) !important;
  box-shadow: 0 0 0 1px var(--sc-border) !important;
}

html body .market-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sc-border);
}

html body .search,
html body #marketSort,
html body .market-filterbar select {
  min-height: 40px !important;
  border: 1px solid var(--sc-border) !important;
  border-radius: 4px !important;
  background: var(--sc-surface) !important;
  color: var(--sc-ink) !important;
  font: 500 14px var(--sc-font) !important;
}

html body .market-risk-note {
  border: 0 !important;
  border-left: 2px solid var(--sc-warning) !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 4px 0 4px 14px !important;
  color: var(--sc-ink) !important;
  font-size: 13px !important;
}

html body .market-risk-note a {
  color: var(--sc-accent) !important;
  font-weight: 600;
}

html body .detail-nav {
  border-bottom: 1px solid var(--sc-border);
  gap: 4px;
}

html body .detail-nav button {
  min-height: 40px;
  border: 0 !important;
  background: transparent !important;
  color: var(--sc-ink-2) !important;
  font-weight: 600 !important;
  border-radius: 0 !important;
}

html body .detail-nav button.on {
  color: var(--sc-ink) !important;
  box-shadow: inset 0 -2px 0 var(--sc-accent) !important;
}

html body #marketlist table,
html body table.table {
  width: 100%;
  border-collapse: collapse;
}

html body table.table th {
  color: var(--sc-ink-2) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-bottom: 1px solid var(--sc-ink) !important;
  background: transparent !important;
}

html body table.table td {
  border-bottom: 1px solid var(--sc-border) !important;
  font-variant-numeric: tabular-nums;
}

html body table.table tbody tr:hover td {
  background: var(--sc-elevated) !important;
}

html body #marketlist tbody td {
  padding: 16px 12px !important;
  vertical-align: middle;
}

html body #marketlist tbody td:first-child {
  font-weight: 600;
}

html body #marketlist tbody td:last-child {
  text-align: right;
}

html body #marketlist tbody td a,
html body #marketlist tbody td button,
html body #marketlist tbody td a span,
html body #marketlist tbody td button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  background: transparent !important;
  color: var(--sc-ink) !important;
  border: 1px solid var(--sc-border) !important;
}

html body #marketlist tbody td a:hover,
html body #marketlist tbody td button:hover {
  background: var(--sc-ink) !important;
  color: var(--sc-canvas) !important;
  border-color: var(--sc-ink) !important;
}

html body #marketlist tbody tr {
  transition: background-color 150ms ease;
}

html body #marketlist thead th {
  position: sticky;
  top: 0;
  background: var(--sc-canvas) !important;
  z-index: 1;
}

html body .compact-market {
  border-bottom: 1px solid var(--sc-border);
  border-top: 0 !important;
  background: transparent !important;
  color: var(--sc-ink) !important;
}

html body .compact-market:hover {
  background: var(--sc-elevated) !important;
}

html body .compact-market,
html body .compact-market * {
  font-variant-numeric: tabular-nums;
}

html body .compact-market small,
html body .compact-market .muted {
  color: var(--sc-ink-2) !important;
}

html body .layout button.primary,
html body .layout .mobile-action-link,
html body .layout #action,
html body .layout .max-btn {
  background: transparent !important;
  color: var(--sc-ink) !important;
  border: 1px solid var(--sc-border) !important;
  border-radius: 4px !important;
  min-height: 40px;
  font-weight: 600 !important;
}

html body .layout button.primary:hover,
html body .layout .mobile-action-link:hover,
html body .layout #action:hover,
html body .layout .max-btn:hover {
  background: var(--sc-ink) !important;
  color: var(--sc-canvas) !important;
  border-color: var(--sc-ink) !important;
}

html body .layout a,
html body .layout .external-icon,
html body .layout .market-link {
  color: var(--sc-ink) !important;
  text-decoration-color: var(--sc-border);
}

html body .layout .detail-nav button.on {
  box-shadow: inset 0 -2px 0 var(--sc-ink) !important;
  color: var(--sc-ink) !important;
}

html body .layout i {
  background: var(--sc-ink) !important;
}

@media (max-width: 1100px) {
  html body .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  html body .layout > aside {
    position: static;
    max-height: none;
    overflow: visible;
    order: -1;
    padding-left: 0;
  }

  html body .layout > article,
  html body .layout > aside {
    border: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

@media (max-width: 900px) {
  html body .home-how {
    grid-template-columns: 1fr;
  }

  html body .home-how article + article {
    padding-left: 0;
    margin-top: 32px;
  }
}

html body .layout > aside .tabs {
  width: 100%;
  gap: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--sc-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
}

html body .layout > aside .tabs button {
  min-width: 0;
  padding: 0 4px !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .layout > aside .tabs button.on {
  color: var(--sc-ink) !important;
  border-bottom-color: var(--sc-accent) !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .layout > aside .tabs button:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

html body .layout > aside #form .withdraw-choice-label {
  margin: 0 0 8px;
  color: var(--sc-ink-2);
  font-size: 13px;
  font-weight: 500;
}

html body .layout > aside #form .withdraw-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

html body .layout > aside #form .withdraw-choice-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--sc-border) !important;
  border-radius: 8px !important;
  background: var(--sc-surface) !important;
  color: var(--sc-ink-2) !important;
  text-align: left;
  transition: border-color 140ms ease, background-color 140ms ease;
}

html body .layout > aside #form .withdraw-choice-button span {
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

html body .layout > aside #form .withdraw-choice-button small {
  color: var(--sc-ink-2);
  font-size: 12px;
  line-height: 1.2;
}

html body .layout > aside #form .withdraw-choice-button:hover,
html body .layout > aside #form .withdraw-choice-button[aria-pressed="true"] {
  border-color: var(--sc-accent) !important;
  color: var(--sc-ink) !important;
}

html body .layout > aside #form .withdraw-choice-button[aria-pressed="true"] {
  background: var(--sc-elevated) !important;
  box-shadow: inset 0 0 0 1px var(--sc-accent);
}

html body .layout > aside #form .withdraw-choice-button:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html body .layout > aside #form .withdraw-choice-button {
    transition: none;
  }
}

/* Borrow transaction review uses the same market values as the action form. */
html body .borrow-review {
  box-sizing: border-box;
  width: min(560px, calc(100vw - 32px));
  max-height: min(92vh, 820px);
  margin: auto;
  padding: 28px;
  overflow-y: auto;
  border: 1px solid var(--sc-border);
  border-radius: 12px;
  background: var(--sc-surface);
  color: var(--sc-ink);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  font-family: var(--sc-font);
  font-variant-numeric: tabular-nums;
}

html body .borrow-review::backdrop {
  background: rgba(4, 8, 11, 0.7);
}

html body .borrow-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

html body .borrow-review-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--sc-ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

html body .borrow-review h2 {
  margin: 0;
  color: var(--sc-ink);
  font-size: 30px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

html body #borrowReviewClose {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--sc-border);
  border-radius: 6px;
  background: var(--sc-elevated);
  color: var(--sc-ink);
  font-size: 22px;
  line-height: 1;
}

html body #borrowReviewContent {
  padding: 20px;
  border: 1px solid var(--sc-border);
  border-radius: 9px;
  background: var(--sc-elevated);
}

html body .borrow-review-market {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sc-border);
  font-size: 18px;
}

html body .borrow-review-market .coin {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
}

html body .borrow-review-market strong {
  color: var(--sc-ink);
  font-weight: 600;
}

html body .borrow-review-slash {
  margin: 0 2px;
  color: var(--sc-ink-2);
}

html body .borrow-review-lltv {
  margin-left: auto;
  padding: 5px 8px;
  border: 1px solid var(--sc-border);
  border-radius: 4px;
  color: var(--sc-ink-2);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

html body .borrow-review-section {
  padding: 17px 0;
  border-bottom: 1px solid var(--sc-border);
}

html body .borrow-review-label {
  color: var(--sc-ink-2);
  font-size: 13px;
  font-weight: 500;
}

html body .borrow-review-amount {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 7px;
}

html body .borrow-review-amount strong {
  color: var(--sc-ink);
  font-size: 22px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

html body .borrow-review-amount small {
  color: var(--sc-ink-2);
  font-size: 12px;
}

html body .borrow-review-position {
  padding-top: 10px;
}

html body .borrow-review-position > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
}

html body .borrow-review-position > div > span:first-child,
html body .borrow-review-change small {
  color: var(--sc-ink-2);
}

html body .borrow-review-position strong {
  color: var(--sc-ink);
  font-weight: 600;
}

html body .borrow-review-change {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

html body .borrow-review-change i {
  color: var(--sc-ink-2);
  font-style: normal;
}

html body .borrow-review-risk {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--sc-border);
  color: var(--sc-ink-2);
  font-size: 12px;
  line-height: 1.5;
}

html body .borrow-review-error {
  margin: 16px 0 0;
  color: var(--sc-danger);
  font-size: 13px;
}

html body .borrow-review-execution {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--sc-border);
  border-radius: 6px;
  color: var(--sc-ink);
  font-size: 13px;
  line-height: 1.45;
}

html body #borrowReviewConfirm {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  border: 1px solid var(--sc-accent);
  border-radius: 6px;
  background: var(--sc-accent);
  color: var(--sc-accent-ink);
  font-size: 15px;
  font-weight: 650;
}

html body #borrowReviewConfirm:hover:not(:disabled) {
  filter: brightness(1.08);
}

html body #borrowReviewConfirm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

html body .borrow-review-footnote {
  margin: 12px 0 0;
  color: var(--sc-ink-2);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

html body .borrow-review :is(button, a):focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  html body .borrow-review {
    padding: 18px;
  }

  html body #borrowReviewContent {
    padding: 15px;
  }

  html body .borrow-review h2 {
    font-size: 26px;
  }

  html body .borrow-review-market {
    font-size: 15px;
  }

  html body .borrow-review-lltv {
    margin-left: 0;
  }

  html body .borrow-review-amount strong {
    font-size: 19px;
  }
}

/* Keep the repayment action in view while the taller estimate scrolls. */
html body .layout > aside #form:has(#repayAmount) > #action {
  position: sticky;
  bottom: 12px;
  z-index: 4;
  box-shadow: 0 0 0 8px var(--sc-canvas);
}

html body .layout > aside #form:has(#repayAmount) > #action:not(:disabled) {
  border-color: var(--sc-accent) !important;
  background: var(--sc-accent) !important;
  color: var(--sc-accent-ink) !important;
}

html body .layout > aside #form:has(#repayAmount) > #action:disabled {
  border-color: var(--sc-border) !important;
  background: var(--sc-elevated) !important;
  color: var(--sc-ink-2) !important;
  opacity: 1;
}

@media (min-width: 901px) {
  html body .layout > aside:has(#repayAmount) {
    max-height: calc(100vh - 168px);
  }
}
