:root {
  color-scheme: dark;
  font:
    0.9375rem / 1.45 system-ui,
    sans-serif;
  --base: #0d1a24;
  --header: #12242f;
  --surface: #152831;
  --line: #2a434f;
  --text: #eaf2f5;
  --muted: #a2b8c3;
  --accent: #66d8f0;
  --buy: #75e0ae;
  --sell: #ff9b9d;
  background: var(--base);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.terminal {
  max-width: 90rem;
  margin: 1rem auto;
  width: calc(100% - 2rem);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  overflow: hidden;
}

.auth-card {
  max-width: 32rem;
  padding: 1.25rem;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.account-summary > div {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
}

:where(#transfers) form {
  margin-top: 0.75rem;
  gap: 0.75rem;
}

:where(#transfers) select {
  max-width: 100%;
}

.auth-card form {
  display: grid;
  gap: 0.9rem;
}

.auth-card :where(button) {
  justify-self: start;
}

.auth-devices {
  list-style: none;
  padding: 0;
}

.auth-devices li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.app-header,
.toolbar {
  padding: 0.7rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  background: var(--header);
}

a {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand,
.status {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.brand {
  justify-self: start;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: #173b4b;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.accounts,
.toolbar nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.accounts {
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.15rem;
  background: #0e1d27;
}

.accounts a,
.accounts span,
.toolbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.38rem 0.65rem;
  border-radius: 0.35rem;
}

.accounts [aria-current],
.toolbar [aria-current] {
  color: var(--accent);
  background: #1a3d4d;
}

.status,
.muted,
.context,
time {
  color: var(--muted);
  font-size: 0.8125rem;
}

.status {
  justify-self: end;
}

.status::before {
  content: "";
  flex: 0 0 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--buy);
}

.status.warning::before {
  background: var(--sell);
}

.warning {
  color: var(--sell);
}

.toolbar,
.split,
.detail-actions,
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: 1.3rem;
}

h2 {
  font-size: 1.125rem;
}

h3 {
  font-size: 0.9rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(20rem, 1fr);
}

.workspace.single {
  grid-template-columns: minmax(0, 1fr);
}

.activity,
.detail,
.composer {
  min-width: 0;
  padding: 1rem 1.15rem 1.25rem;
}

.detail {
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.list-heading,
.filters,
.detail-actions,
.pagination {
  margin-block: 0.65rem;
}

.list-heading:first-child {
  margin-top: 0;
}

.context {
  border: 1px solid var(--line);
  padding: 0.18rem 0.45rem;
  border-radius: 0.35rem;
  white-space: nowrap;
}

.filters,
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 0.5rem;
}

@media (min-width: 64rem) {
  .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  }
}

label,
.stack {
  display: grid;
  gap: 0.3rem;
}

label {
  min-width: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: #152630;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.primary,
.secondary {
  display: inline-block;
  padding: 0.42rem 0.65rem;
  border: 1px solid #3b6372;
  border-radius: 0.4rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  color: #092431;
  background: #7cdef1;
  border-color: #9de9f7;
}

.secondary {
  color: var(--accent);
  background: #153744;
}

.table-scroll {
  overflow-x: auto;
}

.executions {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.executions th,
.executions td {
  padding: 0.52rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #233947;
}

.executions thead {
  background: #1a303e;
  color: #bfd1d9;
  font-size: 0.8125rem;
}

.executions .numeric {
  text-align: right;
  white-space: nowrap;
}

.executions .day th {
  padding-block: 0.32rem;
  color: var(--muted);
  background: var(--header);
  font-size: 0.8125rem;
}

.executions .selected {
  --selection-background: #173642;
}

.executions .selected td {
  background: var(--selection-background);
}

.executions .selected td:first-child {
  box-shadow: inset 2px 0 var(--accent);
}

.ticker {
  color: var(--accent);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.buy {
  color: var(--buy);
}

.sell {
  color: var(--sell);
}

.mobile-time {
  display: none;
}

.detail-ticker {
  margin: 0.35rem 0 0.6rem;
  color: var(--text);
  font-size: 1.5rem;
}

.side-badge {
  display: inline-block;
  padding: 0.16rem 0.43rem;
  border-radius: 0.35rem;
  background: #14392f;
  font-size: 0.8125rem;
}

.side-badge.sell {
  background: #462c36;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  padding-block: 0.55rem;
  border-block: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.facts dd {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.entry,
.idea-link {
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.entry time {
  text-align: right;
}

.note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-facts {
  color: #ffd492;
  font-size: 0.8125rem;
}

.idea-link {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.3rem;
  text-decoration: none;
}

.idea-link span,
.empty {
  color: var(--muted);
}

.empty,
.rules,
.link-form {
  margin-top: 0.8rem;
}

.check {
  display: flex;
  align-items: flex-start;
}

.composer {
  border-top: 1px solid var(--line);
  background: #18313d;
}

.composer .stack,
.rules .stack {
  margin-top: 0.65rem;
}

.back {
  display: inline-block;
  margin-bottom: 0.4rem;
}

@media (max-width: 52rem) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .app-header {
    grid-template-columns: 1fr auto;
  }

  .status {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 32rem) {
  .terminal {
    margin-block: 0;
    width: 100%;
    border-inline: 0;
    border-radius: 0;
  }

  .app-header,
  .toolbar,
  .activity,
  .detail,
  .composer {
    padding-inline: 0.75rem;
  }

  .executions th,
  .executions td {
    padding-inline: 0.3rem;
  }

  .time-column {
    display: none;
  }

  .mobile-time {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
  }
}

@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 1rem;
  }

  .primary,
  .secondary,
  .accounts a,
  .toolbar nav a {
    min-height: 2.75rem;
    align-content: center;
  }
}

.filters .secondary {
  justify-self: start;
}

.stack > button {
  justify-self: start;
}

.portfolio-facts {
  margin-block: 1rem;
}

.portfolio-facts dd {
  font-size: clamp(1rem, 2vw, 1.5rem);
}

.portfolio-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr) minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 0.75rem;
  margin-block: 0.8rem 1rem;
}

.dashboard-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.dashboard-card h2,
.dashboard-note,
.dashboard-periods,
.dashboard-card > .muted {
  padding: 0.5rem 0.65rem;
}

.dashboard-card .executions :is(th, td) {
  padding: 0.35rem 0.45rem;
  font-size: 0.82rem;
}

.dashboard-periods p,
.dashboard-note {
  margin: 0;
  font-size: 0.76rem;
}

.dashboard-nav {
  display: block;
  padding: 0 0.65rem;
  font-size: clamp(1.25rem, 1.8vw, 1.85rem);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dashboard-balances {
  padding: 0 0.65rem;
  font-size: 0.85rem;
}

.dashboard-balances > div {
  display: flex;
  justify-content: space-between;
  gap: 0.45rem;
  padding-block: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.dashboard-balances dt {
  color: var(--muted);
}

.dashboard-balances dd {
  margin: 0;
  text-align: right;
}

@media (max-width: 73rem) {
  .portfolio-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 38rem) {
  .portfolio-dashboard {
    grid-template-columns: minmax(0, 1fr);
  }
}

.portfolio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 1rem;
}

.portfolio-grid > section,
.portfolio-futures {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
}

.portfolio-grid h2,
.portfolio-futures h2,
.portfolio-futures > .muted,
.portfolio-grid .empty,
.portfolio-futures .empty {
  padding: 0.55rem 0.75rem;
}

.portfolio-futures {
  margin-top: 1rem;
}

.portfolio-futures > .muted {
  padding-top: 0;
}

.position-kind {
  display: block;
  font-weight: 400;
}

.composition {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0.4rem 0.75rem 0.75rem;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.composition meter {
  display: block;
  width: 100%;
  height: 0.65rem;
  margin-top: 0.25rem;
  accent-color: var(--accent);
}

@media (max-width: 64rem) {
  .portfolio-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 32rem) {
  .toolbar,
  .toolbar nav {
    flex-wrap: wrap;
  }

  .toolbar nav a {
    padding-inline: 0.45rem;
  }
}

.history-content {
  display: grid;
  min-width: 0;
  gap: 0.65rem;
  padding: 0.25rem 0.75rem 0.75rem;
}

.period-performance {
  margin-block: 1rem;
}

.history-chart {
  display: block;
  width: 100%;
  background: var(--base);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
}

.history-chart .chart-axis {
  stroke: var(--line);
}

.history-chart circle {
  fill: var(--accent);
}

.history-chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.history-values {
  display: grid;
  gap: 0.25rem;
  padding: 0;
  list-style: none;
}

.portfolio-allocation {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  margin: 0;
  padding: 0.3rem 0.85rem 0.85rem;
}

.allocation-chart {
  width: min(100%, 17rem);
  height: auto;
  aspect-ratio: 1;
}

.allocation-track,
.allocation-arc {
  fill: none;
  stroke-width: 32;
}

.allocation-track {
  stroke: var(--line);
}

.allocation-arc {
  stroke: var(--slice-color);
}

.allocation-arc:hover {
  stroke-width: 36;
}

.allocation-dashboard {
  width: 100%;
}

.portfolio-overview {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.allocation-visual {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

.allocation-visual svg {
  flex-shrink: 0;
  aspect-ratio: auto;
}

.allocation-sector,
.allocation-exposure {
  fill: var(--slice-color);
  stroke: var(--base);
  stroke-width: 1.2;
}

.allocation-sector:hover,
.allocation-sector:focus,
.allocation-exposure:hover,
.allocation-exposure:focus {
  filter: brightness(1.2);
  stroke: var(--text);
  outline: none;
}

.allocation-liquid {
  --slice-color: #e9eef0;
}

.allocation-bond {
  --slice-color: #edbc91;
}

.allocation-negative {
  stroke: #f08091;
}

.allocation-margin {
  stroke: #ed91b4;
  stroke-width: 1.5;
}

.allocation-hatch-base {
  fill: #e979a4;
  fill-opacity: 0.15;
}

.allocation-hatch-line {
  stroke: #c94372;
  stroke-width: 3;
}

.allocation-callout polyline {
  fill: none;
  stroke: var(--muted);
  stroke-width: 0.65;
}

.allocation-callout text {
  fill: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.allocation-callout .allocation-callout-share {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.allocation-liquidity {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0;
}

.allocation-liquidity dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.allocation-liquidity dd {
  margin: 0.15rem 0 0;
  font-weight: 650;
}

.allocation-values summary {
  cursor: pointer;
  padding-block: 0.5rem;
}

@media (max-width: 64rem) {
  .portfolio-overview {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 40rem) {
  .allocation-visual svg {
    width: 145%;
  }

  .allocation-callout {
    display: none;
  }

  .allocation-liquidity {
    display: grid;
  }
}

.allocation-dashboard :is(.allocation-arc, .allocation-track) {
  stroke-width: 74;
}

.allocation-dashboard .allocation-arc:hover {
  filter: brightness(1.15);
}

.allocation-short {
  --slice-color: #f08091;
}

.allocation-fx {
  --slice-color: #a98af6;
}

.allocation-ring {
  fill: none;
  stroke: var(--slice-color);
  stroke-width: 9;
}

.allocation-ring.allocation-negative {
  stroke: color-mix(in srgb, var(--slice-color), #ef4c74 35%);
}

.allocation-ring:hover {
  stroke-width: 11;
}

.allocation-rings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.allocation-rings h3 {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.86rem;
}

.allocation-rings ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.allocation-rings li {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 0.82rem;
}

.allocation-rings p {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
}

.portfolio-risk {
  display: grid;
  gap: 0.35rem;
}

.portfolio-risk strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.portfolio-basis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.portfolio-basis [aria-current] {
  color: var(--text);
  font-weight: 700;
}

.weekly-charts {
  margin-top: 1rem;
}

.weekly-relative {
  width: 100%;
  height: auto;
}

.weekly-relative text {
  fill: var(--muted);
  font-size: 12px;
}

.weekly-zero {
  stroke: var(--line);
}

.weekly-line {
  fill: none;
  stroke: var(--slice-color);
  stroke-width: 2;
}

.weekly-relative circle,
.weekly-structure rect {
  fill: var(--slice-color);
}

.weekly-legend,
.weekly-structure {
  list-style: none;
  padding: 0;
}

.weekly-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
}

.weekly-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.weekly-structure li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  margin-block: 0.45rem;
}

.weekly-structure svg {
  width: 100%;
  height: 1rem;
}

.allocation-title {
  fill: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
}

.allocation-subtitle {
  fill: var(--muted);
  font-size: 0.85rem;
}

.portfolio-allocation figcaption {
  width: 100%;
  min-width: 0;
}

.allocation-legend {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.allocation-legend li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(3.9rem, auto);
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.33rem 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.allocation-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--slice-color);
}

.allocation-value,
.allocation-legend strong {
  text-align: right;
}

.allocation-value {
  color: var(--muted);
}

.allocation-basis {
  margin-top: 0.65rem;
}

.allocation-classes {
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

.allocation-classes summary {
  cursor: pointer;
  padding: 0.6rem 0.85rem;
}

.allocation-color-1 {
  --slice-color: #43b4ef;
}

.allocation-color-2 {
  --slice-color: #ffd36c;
}

.allocation-color-3 {
  --slice-color: #ec779c;
}

.allocation-color-4 {
  --slice-color: #73dcb6;
}

.allocation-color-5 {
  --slice-color: #bda0ff;
}

.allocation-color-6 {
  --slice-color: #ffa177;
}

.allocation-color-7 {
  --slice-color: #6edbde;
}

.allocation-color-8 {
  --slice-color: #b0bdc9;
}

@media (52rem < width <= 64rem) {
  .portfolio-overview section[aria-labelledby="composition-heading"] {
    order: -1;
  }
}

.portfolio-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.45rem;
}

.analytics-facts {
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}

.trade-editor {
  display: grid;
  gap: 1.25rem;
  padding: clamp(1rem, 4vw, 1.5rem);
  border-left: 0;
  border-top: 1px solid var(--line);
}

.trade-note {
  width: min(100%, 42rem);
  gap: 0.9rem;
}

.trade-note label {
  gap: 0.45rem;
}

.trade-note textarea {
  min-height: 6.5rem;
  padding: 0.65rem 0.75rem;
}

.trade-note-history {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.trade-note-history .split {
  flex-wrap: wrap;
  align-items: baseline;
}

.trade-amount {
  font-weight: 650;
}

.trade-filters,
.trade-filter-bar,
.trade-periods {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.trade-filters {
  margin-block: 0.65rem;
}
.trade-filter-bar {
  align-items: end;
}
.trade-periods {
  margin-inline-start: auto;
}
.trade-filter-bar .check {
  align-self: center;
}
.trade-filter-bar .ticker-filter {
  width: 10rem;
}
.trade-filter-toggle,
.trade-filter-label,
.mobile-order-context {
  display: none;
}

.trade-advanced,
.trade-filter-pair {
  display: grid;
  align-items: end;
  gap: 0.5rem;
}

.trade-advanced {
  width: 100%;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
}
.trade-filter-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.trade-range {
  flex-basis: 100%;
}

@media (max-width: 52rem) {
  .trade-advanced {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
}

@media (max-width: 36rem) {
  .trade-filter-bar {
    width: 100%;
  }
  .trade-filter-bar .ticker-filter {
    flex: 1;
    min-width: 5rem;
  }
  .trade-filter-bar .check {
    align-self: end;
    min-height: 2.75rem;
  }
  .trade-periods {
    margin-inline: 0 auto;
    gap: 0.25rem;
  }
  .trade-filter-toggle {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
  }
  .trade-filter-label {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    color: var(--accent);
    cursor: pointer;
  }
  .trade-filter-label::after {
    content: "▾";
  }
  .trade-filter-toggle:checked + .trade-filter-label::after {
    content: "▴";
  }
  .trade-filter-toggle:focus-visible + .trade-filter-label {
    outline: 2px solid var(--accent);
  }
  .trade-filter-toggle:not(:checked) ~ .trade-advanced {
    display: none;
  }
  .trade-advanced {
    grid-template-columns: minmax(0, 1fr);
  }

  .trade-orders > thead {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  .trade-orders tbody,
  .trade-orders .day,
  .trade-orders .day th {
    display: block;
  }

  .trade-orders > tbody > tr:not(.day, .inline-editor, .trade-series-children) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--line);
  }

  .trade-orders td {
    border: 0;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .trade-orders > tbody > .selected {
    background: var(--selection-background);
    box-shadow: inset 2px 0 var(--accent);
  }

  .trade-orders > tbody > .selected > td {
    background: transparent;
    box-shadow: none;
  }

  .trade-orders .order-instrument {
    grid-area: 1 / 1;
  }
  .trade-orders .trade-amount {
    grid-area: 1 / 2;
  }
  .trade-orders .order-instrument .position-kind,
  .trade-orders .trade-amount[data-label]::before {
    display: none;
  }
  .trade-orders .order-result {
    grid-area: 2 / 2;
  }
  .trade-orders tr:is([id], .trade-series) > :is(.buy, .sell) {
    grid-area: 2 / 1;
    font-size: 0.8125rem;
  }
  .mobile-order-context {
    display: inline;
  }
  .trade-orders tr:is([id], .trade-series) > [data-label="Кол-во"],
  .trade-orders tr:is([id], .trade-series) > [data-label="Комиссия"] {
    text-align: left;
  }

  .trade-orders .time-column {
    display: none;
  }

  .trade-orders .mobile-time,
  .trade-orders [data-label]::before {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 400;
  }

  .trade-orders [data-label]::before {
    content: attr(data-label);
  }
}

.note-mark {
  color: var(--accent);
  display: block;
  font-size: 0.75rem;
}

.trade-totals {
  display: grid;
  gap: 0.25rem;
  padding: 0.65rem 0;
  margin-bottom: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.series-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: normal;
  cursor: pointer;
}

.series-toggle::-webkit-details-marker {
  display: none;
}

.series-toggle::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: translateY(-0.15em) rotate(45deg);
}

details[open] > .series-toggle::after {
  transform: translateY(0.1em) rotate(225deg);
}

.trade-series-children,
.trade-series > .trade-series-children {
  display: none;
}

.trade-series:has(> :is(td, th) > details[open]) + .trade-series-children,
.trade-series:has(> :is(td, th) > details[open]) + .series-editor-row + .trade-series-children {
  display: table-row;
}

.trade-series:has(> .compact-report-header details[open]) > .trade-series-children {
  display: block;
}

.trade-series-children > td,
.series-editor-row > td {
  padding: 0;
}

.series-panel {
  margin: 0.4rem 0.5rem 0.8rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface);
}

.series-panel h3 {
  margin: 0 0 0.55rem;
  font-size: 0.875rem;
}

.series-panel .executions :is(th, td) {
  padding: 0.4rem 0.5rem;
}

.series-panel tbody > tr:last-child > td {
  border-bottom: 0;
}

.series-orders-list > li {
  background: var(--base);
}

@media (max-width: 36rem) {
  .trade-orders .trade-series:has(> td > details[open]) + .trade-series-children,
  .trade-orders
    .trade-series:has(> td > details[open])
    + .series-editor-row
    + .trade-series-children,
  .trade-orders .trade-series-children > td {
    display: block;
  }

  .series-panel {
    margin-inline: 0.15rem;
    padding-inline: 0.45rem;
  }

  .series-orders .series-order-time {
    grid-area: 1 / 1;
  }
}

.trade-orders .inline-editor > td {
  padding: 0;
  text-align: left;
}

.trade-orders .order-note {
  white-space: nowrap;
}

@media (max-width: 36rem) {
  .trade-orders .inline-editor,
  .trade-orders .inline-editor > td {
    display: block;
  }

  .trade-orders .order-note {
    align-self: center;
    text-align: right;
    white-space: normal;
  }
}

.diary-filter-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.desktop-sections {
  display: flex;
  gap: inherit;
}

.more-sections,
.portfolio-week {
  display: none;
}

@media (max-width: 52rem) {
  .toolbar {
    padding-block: 0.2rem;
  }

  .toolbar nav {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(max-content, 1fr));
    width: 100%;
    text-align: center;
  }

  .toolbar nav a,
  .more-sections summary {
    display: grid;
    align-content: center;
    min-height: 44px;
    padding: 0.35rem;
    border-radius: 0.35rem;
  }

  .toolbar > .primary,
  .desktop-sections {
    display: none;
  }

  .more-sections {
    display: block;
  }

  .more-sections summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    list-style: none;
    cursor: pointer;
    color: var(--muted);
  }

  .more-sections summary::-webkit-details-marker {
    display: none;
  }

  .more-sections summary::after {
    content: "▾";
    font-size: 0.75em;
  }

  .more-sections[open] summary,
  .more-sections .current-section {
    color: var(--accent);
    background: #1a3d4d;
  }

  .more-section-list {
    position: absolute;
    z-index: 2;
    inset-inline-end: 0;
    padding: 0.3rem;
    width: min(100%, 13rem);
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--header);
    box-shadow: 0 0.5rem 1rem #0005;
    text-align: left;
  }

  .more-section-list a {
    padding-inline: 0.7rem;
  }

  .more-section-list .primary {
    color: #092431;
    margin: 0.3rem;
  }

  .portfolio-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .portfolio-page > .list-heading {
    margin: 0;
  }

  .portfolio-analytics {
    display: none;
  }

  .portfolio-dashboard,
  .portfolio-overview,
  .portfolio-composition > .portfolio-risk {
    display: contents;
  }

  .portfolio-value {
    padding: 0.75rem;
  }

  .portfolio-value h2 {
    padding: 0;
  }

  .portfolio-value .dashboard-nav {
    padding: 0;
    font-size: 1.65rem;
    white-space: normal;
  }

  .portfolio-value .dashboard-balances {
    padding: 0;
  }

  .portfolio-week {
    display: grid;
    gap: 0.1rem;
    padding-block: 0.55rem;
    margin-block: 0.35rem 0;
    border-top: 1px solid var(--line);
  }

  .portfolio-week > span {
    color: var(--muted);
    font-size: 0.8125rem;
  }

  .portfolio-week-values {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: baseline;
    font-variant-numeric: tabular-nums;
  }

  .portfolio-composition {
    display: flex;
    flex-direction: column;
    order: 1;
  }

  .portfolio-composition > h2 {
    order: -2;
  }

  .portfolio-composition .portfolio-basis {
    order: -1;
    padding-inline: 0.75rem;
  }

  .portfolio-composition .portfolio-risk > .split {
    order: 1;
    margin: 0.25rem 0.75rem;
  }

  .portfolio-composition > .account-summary {
    order: 2;
  }

  .portfolio-composition .allocation-classes {
    order: 3;
  }

  .portfolio-account-breakdown {
    order: 2;
  }

  .portfolio-dashboard > .dashboard-card:not(.portfolio-value) {
    order: 3;
  }

  .portfolio-overview > :not(.portfolio-composition) {
    order: 4;
  }

  .portfolio-page > .portfolio-futures {
    order: 5;
  }
}

@media (max-width: 24rem) {
  .brand-name {
    display: none;
  }
}

.compact-report-list {
  display: none;
}

.compact-report-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.55rem;
}

.compact-report-header time {
  color: inherit;
  font-size: inherit;
}

.compact-report-result {
  display: grid;
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.compact-report-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: 0;
  border-bottom: 0;
}

@media (max-width: 52rem) {
  .compact-report .list-heading {
    flex-wrap: wrap;
  }

  .compact-report-table {
    display: none;
  }

  .compact-report-list {
    display: grid;
    gap: 0.6rem;
    margin: 0.75rem 0;
    padding: 0;
    list-style: none;
  }

  .compact-report-card {
    display: grid;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
    overflow-wrap: anywhere;
  }

  .compact-report-card > .order-note {
    margin: 0;
  }

  .compact-report-list .trade-series-children {
    margin: 0;
  }

  .weekly-card-facts > :first-child {
    grid-column: 1 / -1;
  }

  .weekly-card-facts > :first-child dd {
    font-size: 1.15rem;
  }

  .week-return {
    display: inline-block;
    font-weight: 400;
  }

  .week-report-link {
    flex-shrink: 0;
  }
}

.dynamics-facts {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
}

.dynamics-facts time {
  font-weight: 400;
}

.history-chart text {
  fill: var(--muted);
  font-size: 14px;
}

.history-chart .chart-flow-deposit {
  fill: var(--buy);
}

.history-chart .chart-flow-withdrawal {
  fill: var(--sell);
}

.history-chart-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.8125rem;
}

.transfer-review > summary {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.transfer-review form.split {
  flex-wrap: wrap;
}

.dynamics-cash .numeric {
  white-space: normal;
  overflow-wrap: anywhere;
}

.week-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.week-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.week-review-panel {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  min-width: 0;
  margin-block: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.week-review-panel .split {
  flex-wrap: wrap;
}

.week-review-panel .list-heading {
  margin: 0;
}

.week-review-list,
.week-flow-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.week-review-list .compact-report-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--base);
}

.week-flow-list > li {
  padding-block: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.week-profit {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 52rem) {
  .week-review-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.cash-tabs {
  max-width: 100%;
  margin-bottom: 0.85rem;
}

.cash-tabs a {
  display: flex;
  align-items: center;
}

.cash-forecast {
  display: grid;
  gap: 0.65rem;
}

.cash-totals {
  display: grid;
  gap: 0.55rem;
  margin-block: 0.85rem 1rem;
}

.cash-total-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 0.6rem;
}

.cash-total-card {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.cash-total-card dl > div {
  align-items: baseline;
  padding-block: 0.3rem;
  border-top: 1px solid var(--line);
}

.cash-total-card dd {
  flex-shrink: 0;
  max-width: 48%;
  text-align: right;
}

.position-pnl-help {
  padding-inline: 0.75rem;
  font-size: 0.85rem;
}

.position-sort {
  margin: 0.5rem 0 1rem;
  gap: 0.5rem;
}

.position-sort a {
  padding: 0.55rem;
  border-radius: 0.35rem;
  background: var(--surface);
}

@media (max-width: 52rem) {
  :is(.position-table, .benchmark-table) thead {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  :is(.position-table, .benchmark-table) tbody {
    display: grid;
    gap: 0.6rem;
  }

  :is(.position-table, .benchmark-table) tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
  }

  :is(.position-table, .benchmark-table) tbody th {
    grid-column: 1 / -1;
  }

  .executions:is(.position-table, .benchmark-table) tbody :is(th, td) {
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  :is(.position-table, .benchmark-table) td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
  }
}
