/* Hyperliquid /trade layout. Colors sampled from app.hyperliquid.xyz:
   page #1b2429, panels #0f1a1f, muted #949e9c, text #f6fefd, buy #50d2c1.
   The three-column grid is desktop only; phones keep the stacked layout. */

#chartBox { position: relative; background: #0f1a1f; }
#chartBox .lw-host { position: absolute; inset: 0; z-index: 2; }
#chartBox.lw-on > canvas,
#chartBox.lw-on > .chart-empty,
#chartBox.lw-on > .chart-tip { display: none !important; }
#chartTools[hidden],
.models-trade-desk #chartTools:empty { display: none !important; }
.tv-ohlc {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 4;
  display: flex;
  gap: 14px;
  align-items: baseline;
  font: 400 12px -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  font-variant-numeric: tabular-nums;
  color: #949e9c;
  pointer-events: none;
}
.tv-ohlc .res { color: #f6fefd; }
.tv-ohlc b { font-weight: 400; color: #f6fefd; }
.tv-ohlc b.up { color: #089981; }
.tv-ohlc b.down { color: #F23645; }
.tv-ranges {
  display: flex;
  align-items: center;
  flex: none;
  height: 28px;
  gap: 0;
  padding: 0 8px;
  overflow-x: auto;
  background: #0f1a1f;
  border-top: 1px solid #1b2429;
  font: 400 12px -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
}
.tv-ranges[hidden] { display: none !important; }
.tv-ranges button {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  margin: 0;
  padding: 0 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #949e9c;
  font: inherit;
  line-height: 22px;
  cursor: pointer;
}
.tv-ranges button.on { color: #f6fefd; background: #273035; }
.tv-ranges button:hover { color: #f6fefd; }
.tv-ranges .tv-goto-btn {
  width: 22px;
  padding: 0;
  color: #949e9c;
}
.tv-ranges .tv-goto-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.tv-ranges .tv-tz { margin-left: auto; padding-left: 12px; color: #949e9c; font-size: 12px; }
#chartBox .tradingview-widget-container {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: #0f1a1f;
}
#chartBox .tradingview-widget-container__widget {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: calc(100% - 32px);
}
#chartBox .tradingview-widget-copyright {
  flex: none;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  font-size: 12px;
  color: #949e9c;
}
#chartBox .tradingview-widget-copyright a { color: #50d2c1; text-decoration: none; }
#chartBox.tv-ready > canvas,
#chartBox.tv-ready > .chart-empty,
#chartBox.tv-ready > .chart-tip { display: none !important; }
body.hl-site:has(#chartBox.tv-ready) .models-trade-desk .chart-tools { display: none !important; }

@media (max-width: 980px) {
  .models-trade-desk .hl-ticket { order: 1; }
  .models-trade-desk .hl-book { order: 2; }
  .models-trade-desk .hl-account { order: 3; }
  .models-trade-desk .hl-book-tabs { display: none; }
}

@media (min-width: 981px) {
  body.hl-site.models-terminal-route { background: #1b2429; }
  body.hl-site.models-terminal-route .main {
    background: #1b2429 !important;
    padding: 0 !important;
    height: calc(100dvh - 56px);
    overflow: hidden;
  }
  body.hl-site .nav .btn { border-radius: 8px; }

  body.hl-site .models-trade-desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 356px) minmax(280px, 356px);
    grid-template-rows: minmax(0, 1.47fr) minmax(220px, 1fr);
    grid-template-areas:
      "chart book ticket"
      "bottom bottom account";
    gap: 3px;
    padding: 3px;
    height: calc(100dvh - 56px);
    min-height: 0;
    background: #1b2429;
    box-sizing: border-box;
  }
  body.hl-site .models-trade-desk .mobile-desk-tabs { display: none !important; }
  body.hl-site .models-trade-desk .terminal-side { display: contents; }
  body.hl-site .models-trade-desk .terminal-chart { grid-area: chart; }
  body.hl-site .models-trade-desk .hl-book { grid-area: book; }
  body.hl-site .models-trade-desk .hl-ticket { grid-area: ticket; }
  body.hl-site .models-trade-desk .hl-account { grid-area: account; }
  body.hl-site .models-trade-desk .terminal-bottom { grid-area: bottom; }
  body.hl-site .models-trade-desk .terminal-panel,
  body.hl-site .models-trade-desk .hl-book,
  body.hl-site .models-trade-desk .hl-ticket,
  body.hl-site .models-trade-desk .hl-account {
    background: #0f1a1f;
    min-width: 0;
    min-height: 0;
  }

  body.hl-site .models-trade-desk .terminal-chart {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.hl-site .models-trade-desk .dex-head {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 16px;
    height: 62px;
    min-height: 62px;
    max-height: 62px;
    padding: 0 12px;
    border-bottom: 0;
    overflow: hidden;
  }
  body.hl-site .models-trade-desk .dex-head .pair-btn {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 340px);
    overflow: hidden;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    color: #f6fefd;
    white-space: nowrap;
  }
  body.hl-site .models-trade-desk .dex-av { width: 24px; height: 24px; }
  body.hl-site .models-trade-desk .dex-names { min-width: 0; overflow: hidden; flex: 1 1 auto; }
  body.hl-site .models-trade-desk .dex-pair {
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
  }
  body.hl-site .models-trade-desk #pairLabel {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 20px;
    font-weight: 400;
  }
  body.hl-site .models-trade-desk .dex-quote { flex: none; }
  body.hl-site .models-trade-desk .dex-quote {
    color: #949e9c;
    font-size: 20px;
    font-weight: 400;
  }
  body.hl-site .models-trade-desk .dex-meta,
  body.hl-site .models-trade-desk .dex-price em { display: none; }
  body.hl-site .models-trade-desk .dex-stats {
    display: flex;
    flex: 0 0 auto;
    gap: 22px;
    margin: 0 0 0 auto;
    min-width: 0;
    position: relative;
    z-index: 1;
    background: #0f1a1f;
  }
  body.hl-site .models-trade-desk .dex-stat {
    display: grid;
    gap: 2px;
    min-width: 0;
  }
  body.hl-site .models-trade-desk .dex-stat span {
    color: #949e9c;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
  }
  body.hl-site .models-trade-desk .dex-stat strong,
  body.hl-site .models-trade-desk .dex-price strong {
    color: #f6fefd;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    white-space: nowrap;
  }
  body.hl-site .models-trade-desk .dex-price strong { color: #50d2c1; }
  body.hl-site .models-trade-desk .chart-box {
    flex: 1;
    min-height: 0;
    height: auto;
  }

  body.hl-site .models-trade-desk .hl-book,
  body.hl-site .models-trade-desk .hl-ticket {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.hl-site .models-trade-desk .hl-book-tabs {
    display: flex;
    align-items: stretch;
    gap: 16px;
    height: 42px;
    padding: 0 12px;
    border-bottom: 1px solid #1b2429;
    flex: none;
  }
  body.hl-site .models-trade-desk .hl-book-tabs span {
    display: inline-flex;
    align-items: center;
    color: #949e9c;
    font-size: 12px;
  }
  body.hl-site .models-trade-desk .hl-book-tabs .on {
    color: #f6fefd;
    box-shadow: inset 0 -1px 0 #f6fefd;
  }
  body.hl-site .models-trade-desk .hl-book-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
  }
  body.hl-site .models-trade-desk .dex-windows { display: none; }
  body.hl-site .models-trade-desk .dex-flow,
  body.hl-site .models-trade-desk .dex-pool {
    padding: 8px 10px;
    border-bottom: 0;
    gap: 0;
    font-size: 12px;
  }
  body.hl-site .models-trade-desk .dex-flow-top,
  body.hl-site .models-trade-desk .dex-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
  }
  body.hl-site .models-trade-desk .dex-flow-top div,
  body.hl-site .models-trade-desk .dex-split div,
  body.hl-site .models-trade-desk .dex-pool-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 2px;
    font-variant-numeric: tabular-nums;
  }
  body.hl-site .models-trade-desk .dex-flow span,
  body.hl-site .models-trade-desk .dex-pool span { color: #949e9c; }
  body.hl-site .models-trade-desk .up { color: #50d2c1; }
  body.hl-site .models-trade-desk .down { color: #ed7088; }
  body.hl-site .models-trade-desk .dex-bar { height: 4px; margin: 6px 0; }
  body.hl-site .models-trade-desk .dex-bar .buy { background: #50d2c1; }
  body.hl-site .models-trade-desk .dex-bar .sell { background: #ed7088; }

  body.hl-site .models-trade-desk .hl-ticket,
  body.hl-site .models-trade-desk .hl-account { overflow: auto; }
  body.hl-site .models-trade-desk .hl-account { padding: 8px 12px 12px; }
  body.hl-site .models-trade-desk .dex-trade {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  body.hl-site .models-trade-desk #entry {
    padding: 12px;
  }
  body.hl-site .models-trade-desk #entry .seg { gap: 8px; }
  body.hl-site .models-trade-desk #entry .seg button {
    min-height: 40px;
    border-radius: 8px;
    background: #273035;
    color: #f6fefd;
    font-size: 12px;
    font-weight: 400;
  }
  body.hl-site .models-trade-desk #entry .seg button.on.buy {
    background: #50d2c1;
    color: #02231e;
  }
  body.hl-site .models-trade-desk #entry .seg button.on.sell {
    background: #ed7088;
    color: #1a0a0e;
  }
  body.hl-site .models-trade-desk #entry .avail,
  body.hl-site .models-trade-desk #entry label,
  body.hl-site .models-trade-desk #entry .quote .k { color: #949e9c; font-size: 12px; }
  body.hl-site .models-trade-desk #entry .quote .dim.small { display: none; }
  body.hl-site .models-trade-desk #entry .inp {
    border: 1px solid #273035;
    border-radius: 8px;
    background: transparent;
    min-height: 40px;
  }
  body.hl-site .models-trade-desk #entry .pcts button {
    border-radius: 8px;
    background: #273035;
    min-height: 28px;
  }
  body.hl-site .models-trade-desk #entry .size-slider { accent-color: #50d2c1; }
  body.hl-site .models-trade-desk.dex-pair #sendBtn.btn-accent:not(:disabled),
  body.hl-site .models-trade-desk.dex-pair #deskConnect.btn-accent,
  body.hl-site .models-trade-desk #entry #sendBtn,
  body.hl-site .models-trade-desk #entry #deskConnect {
    background: #50d2c1 !important;
    border-color: #50d2c1 !important;
    color: #04060c !important;
    border-radius: 8px !important;
    height: 40px !important;
    min-height: 40px !important;
    font-size: 12px !important;
    font-weight: 400 !important;
  }
  body.hl-site .models-trade-desk #acctAnn a {
    color: #949e9c;
    background: transparent;
    min-height: 0;
    padding: 4px 0;
  }

  body.hl-site .models-trade-desk .terminal-bottom .desk-tabs {
    height: 40px;
    min-height: 40px;
    padding: 0 4px;
    background: #0f1a1f;
    border-bottom: 1px solid #1b2429;
  }
  body.hl-site .models-trade-desk .terminal-bottom .desk-tabs button {
    color: #949e9c;
    font-size: 12px;
    padding: 0 12px;
    height: 40px;
  }
  body.hl-site .models-trade-desk .terminal-bottom .desk-tabs button.on,
  body.hl-site .models-trade-desk .terminal-bottom .desk-tabs button[aria-selected="true"] {
    color: #f6fefd;
    border-bottom-color: #f6fefd;
  }
  body.hl-site .models-trade-desk #bottomBody .tbl { font-size: 12px; }
  body.hl-site .models-trade-desk #bottomBody .tbl thead th { color: #949e9c; font-weight: 400; }

  body.hl-site .nav-links a {
    color: #949e9c;
    font-size: 14px;
    font-weight: 400;
  }
  body.hl-site .nav-links a.active,
  body.hl-site .nav-links a[aria-current="page"] { color: #50d2c1; }

  body.hl-site .models-trade-desk .pair-chevron {
    color: #949e9c;
    font-size: 10px;
  }
  body.hl-site .models-trade-desk .dex-flow strong,
  body.hl-site .models-trade-desk .dex-pool-row strong,
  body.hl-site .models-trade-desk .dex-flow span,
  body.hl-site .models-trade-desk .dex-pool-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.hl-site .models-trade-desk .dex-flow strong,
  body.hl-site .models-trade-desk .dex-pool-row strong {
    max-width: 62%;
    font-weight: 400;
    color: #f6fefd;
    text-align: right;
  }
  body.hl-site .models-trade-desk .dex-flow-top div,
  body.hl-site .models-trade-desk .dex-split div,
  body.hl-site .models-trade-desk .dex-pool-row {
    align-items: center;
    min-height: 22px;
    padding: 0 2px;
  }
  body.hl-site .models-trade-desk .copy {
    border: 0;
    background: transparent;
    color: #949e9c;
    font-size: 11px;
    padding: 0 2px;
  }

  body.hl-site .models-trade-desk .hl-account { padding: 10px 12px 12px; }
  body.hl-site .models-trade-desk .acct-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    min-height: 24px;
    font-size: 12px;
  }
  body.hl-site .models-trade-desk .acct-row span { color: #949e9c; }
  body.hl-site .models-trade-desk .acct-row strong {
    color: #f6fefd;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
  }
  body.hl-site .models-trade-desk .acct-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
  }
  body.hl-site .models-trade-desk .acct-actions .primary {
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: #50d2c1;
    color: #02231e;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
  }
  body.hl-site .models-trade-desk .acct-actions .ghost {
    color: #949e9c;
    font-size: 12px;
    text-decoration: none;
  }
  body.hl-site .models-trade-desk #acctAnn,
  body.hl-site .models-trade-desk #acctAnnBody {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 14px;
    padding: 0;
  }
  body.hl-site .models-trade-desk #acctAnnBody { margin-top: 0; }

  body.hl-site .models-trade-desk #entry .avail {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin: 8px 0 0;
    font-size: 12px;
  }
  body.hl-site .models-trade-desk #entry .avail .v {
    color: #f6fefd;
    font-variant-numeric: tabular-nums;
  }
  body.hl-site .models-trade-desk #entry .pcts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  body.hl-site .models-trade-desk #entry .pcts button {
    color: #f6fefd;
    font-size: 12px;
    font-weight: 400;
    border: 0;
  }
}

/* Portfolio, laid out like Hyperliquid's portfolio screen. */
body.hl-site .main:has(.pf) {
  background: #07110f !important;
  padding: 0 !important;
  max-width: none !important;
  height: auto !important;
  min-height: calc(100dvh - 56px);
  overflow: auto !important;
}
.pf {
  position: relative;
  min-height: calc(100dvh - 56px);
  padding: 28px 28px 120px;
  box-sizing: border-box;
  color: #f6fefd;
  background:
    radial-gradient(900px 280px at 78% 118%, rgba(63, 143, 132, 0.16), transparent 70%),
    #07110f;
  overflow: hidden;
}
.pf::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -80px;
  height: 340px;
  pointer-events: none;
  background:
    repeating-radial-gradient(ellipse 160% 90% at 50% 140%, transparent 0 38px, rgba(80, 210, 193, 0.16) 39px 40px);
}
body.hl-site.profile-route .pf .pf-tabs button {
  background: transparent !important;
  color: #949e9c !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
body.hl-site.profile-route .pf .pf-tabs button.on {
  color: #f6fefd !important;
  box-shadow: inset 0 -1px 0 #f6fefd !important;
}
body.hl-site.profile-route .pf .pf-link,
body.hl-site.profile-route .pf .pf-chart-h button {
  background: transparent !important;
  color: #50d2c1 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
body.hl-site.profile-route .pf .pf-pill {
  background: transparent !important;
  color: #f6fefd !important;
  border: 1px solid #2a3a36 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}
.pf-top, .pf-cards, .pf-tabs, .pf-panel { position: relative; z-index: 1; }
.pf-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pf h1 { margin: 0; font-size: 32px; font-weight: 500; letter-spacing: -0.02em; }
.pf-actions { display: flex; gap: 8px; }
.pf-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #2a3a36;
  border-radius: 6px;
  background: transparent;
  color: #f6fefd;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.pf-cards {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(240px, 1fr) minmax(320px, 1.35fr);
  gap: 12px;
  margin-top: 18px;
}
.pf-card {
  background: #0f1a1f;
  border-radius: 8px;
  padding: 16px 18px 14px;
  min-height: 248px;
  box-sizing: border-box;
}
.pf-card .k { color: #949e9c; font-size: 12px; }
.pf-card .k.fee { margin-top: 22px; }
.pf-card .k.head { margin-bottom: 10px; }
.pf-card .big {
  margin: 6px 0 10px;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.pf-link {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: none;
  color: #50d2c1;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.pf-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.pf-row span { color: #c5d0ce; }
.pf-row b { font-weight: 400; }
.pf-chart-h {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: #949e9c;
}
.pf-chart-h .on { color: #f6fefd; box-shadow: inset 0 -1px 0 #f6fefd; padding-bottom: 6px; }
.pf-chart-h b { margin-left: auto; font-weight: 400; color: #f6fefd; font-variant-numeric: tabular-nums; }
.pf-spark { display: block; width: 100%; height: 168px; margin-top: 8px; }
.pf-tabs {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  border-bottom: 1px solid #1c2a28;
  overflow-x: auto;
}
.pf-tabs button {
  appearance: none;
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #949e9c;
  font-size: 13px;
  cursor: pointer;
}
.pf-tabs button.on { color: #f6fefd; box-shadow: inset 0 -1px 0 #f6fefd; }
.pf-panel { min-height: 160px; padding-top: 8px; }
.pf-empty { padding: 14px 2px 28px; color: #949e9c; font-size: 13px; }
.pf .pf-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.pf .pf-tbl th {
  color: #949e9c;
  font-weight: 400;
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid #1c2a28;
}
.pf .pf-tbl th.l, .pf .pf-tbl td.l { text-align: left; }
.pf .pf-tbl td { padding: 10px; text-align: right; font-variant-numeric: tabular-nums; border-bottom: 1px solid rgba(28, 42, 40, 0.7); }
.pf .pf-tbl a { color: #f6fefd; text-decoration: none; }
.pf .pf-tbl a:hover { color: #50d2c1; }
.pf .up { color: #50d2c1; }
.pf .down { color: #ed7088; }
@media (max-width: 980px) {
  .pf { padding: 18px 14px 80px; }
  .pf h1 { font-size: 26px; }
  .pf-cards { grid-template-columns: 1fr; }
  .pf-card { min-height: 0; }
}
