.printer-frame #main:has(#portfolio-workspace:not([hidden])) > :not(#portfolio-workspace) {
  display: none !important;
}

.printer-frame #main:has(#portfolio-workspace:not([hidden])) {
  background: #141414;
  overflow: hidden;
}

.portfolio-workspace {
  --pf-bg: #141414;
  --pf-panel: #1b1c1e;
  --pf-panel-raised: #232428;
  --pf-rule: #34363a;
  --pf-ink: #f5f0e6;
  --pf-muted: #a5a6a9;
  --pf-soft: #777a80;
  --pf-cobalt: #91a0ff;
  --pf-alert: #dc927f;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  padding: 20px 16px 14px;
  overflow: auto;
  background: var(--pf-bg);
  color: var(--pf-ink);
  color-scheme: dark;
}

.portfolio-workspace button,
.portfolio-workspace input,
.portfolio-workspace select {
  color: inherit;
}

.portfolio-topline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
}

.portfolio-title > div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--pf-muted);
  font-size: 11px;
  font-weight: 630;
}

.portfolio-title img {
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.portfolio-title b {
  margin: 0 4px;
  color: #5f6268;
  font-weight: 400;
}

.portfolio-title h1 {
  margin: 3px 0 0;
  color: var(--pf-ink);
  font-size: clamp(24px, 2.1vw, 31px);
  line-height: 1.05;
  font-weight: 740;
  letter-spacing: -.055em;
}

.portfolio-title p {
  margin: 5px 0 0;
  color: var(--pf-muted);
  font-size: 11px;
  line-height: 1.4;
}

.portfolio-controls {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 7px;
  min-width: 0;
  padding-bottom: 2px;
}

.portfolio-wallet {
  display: grid;
  gap: 2px;
  margin-right: 8px;
  padding-right: 16px;
  border-right: 1px solid var(--pf-rule);
}

.portfolio-wallet span,
.portfolio-summary span,
.portfolio-amount small,
.portfolio-market small {
  color: var(--pf-muted);
  font-size: 10px;
  font-weight: 520;
}

.portfolio-wallet strong {
  font-size: 11px;
  font-weight: 680;
}

.portfolio-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 33px;
  padding: 0 11px;
  border: 1px solid #4a4c51;
  border-radius: 5px;
  background: #27282b;
  color: var(--pf-ink);
  font-size: 11px;
  font-weight: 650;
}

.portfolio-controls button:hover {
  background: #303237;
}

.portfolio-controls button[data-open-wallets] {
  border-color: #6472dd;
  background: #4555cf;
  color: #fff;
}

.portfolio-controls button[data-open-wallets]:hover {
  background: #5362df;
}

.portfolio-controls button img {
  width: 12px;
  height: 12px;
}

.portfolio-summary {
  display: grid;
  grid-template-columns: minmax(135px, 1fr) minmax(135px, 1fr) minmax(135px, 1fr) minmax(240px, 1.45fr);
  min-height: 76px;
  overflow: hidden;
  border: 1px solid var(--pf-rule);
  border-top: 2px solid #5666e2;
  border-radius: 6px;
  background: var(--pf-panel);
}

.portfolio-summary > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 12px 17px;
}

.portfolio-summary > div + div {
  border-left: 1px solid var(--pf-rule);
}

.portfolio-summary strong {
  margin-top: 3px;
  color: var(--pf-ink);
  font-size: 18px;
  line-height: 1.1;
  font-weight: 690;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.portfolio-summary small {
  margin-top: 4px;
  color: var(--pf-soft);
  font-size: 10px;
}

.portfolio-summary .portfolio-summary-note {
  flex-direction: row;
  align-items: center;
  gap: 11px;
  background: #202126;
}

.portfolio-summary-note img {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
}

.portfolio-summary-note span {
  max-width: 310px;
  color: #bbbcc2;
  font-size: 10px;
  line-height: 1.45;
}

.portfolio-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, .36fr);
  gap: 12px;
  min-height: 420px;
  flex: 1;
}

.portfolio-positions,
.portfolio-activity {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--pf-rule);
  border-radius: 6px;
  background: var(--pf-panel);
}

.portfolio-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 67px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pf-rule);
}

.portfolio-panel-header h2 {
  margin: 0;
  color: var(--pf-ink);
  font-size: 16px;
  line-height: 1.15;
  font-weight: 690;
  letter-spacing: -.025em;
}

.portfolio-panel-header h2 span {
  margin-left: 6px;
  color: var(--pf-soft);
  font-size: 11px;
}

.portfolio-panel-header p {
  margin: 4px 0 0;
  color: var(--pf-muted);
  font-size: 10px;
}

.portfolio-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.portfolio-tools input,
.portfolio-tools select {
  min-height: 33px;
  border: 1px solid #414349;
  border-radius: 5px;
  background: #25262a;
  color: var(--pf-ink);
  font-size: 11px;
}

.portfolio-tools input {
  width: 190px;
  min-width: 0;
  padding: 0 9px;
}

.portfolio-tools input::placeholder {
  color: #a5a6aa;
}

.portfolio-tools select {
  max-width: 154px;
  padding: 0 7px;
}

.portfolio-position-list,
.portfolio-activity-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #55575c transparent;
}

.portfolio-position {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) minmax(95px, .9fr) minmax(95px, .82fr) minmax(85px, .76fr) minmax(115px, 1fr) 106px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 92px;
  padding: 12px 15px;
  border-bottom: 1px solid #303236;
}

.portfolio-position:hover,
.portfolio-position:focus-within {
  background: #222429;
}

.portfolio-position.hidden {
  border-left: 3px solid #ba6c5b;
  padding-left: 12px;
}

.portfolio-asset {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.portfolio-asset-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  border: 1px solid #54575f;
  border-radius: 5px;
  background: #32343b;
  color: #dddfe6;
  font-size: 11px;
  font-weight: 760;
}

.portfolio-asset-mark.printer {
  border-color: #7885e8;
  background: #f4f0e8;
}

.portfolio-asset-mark img {
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.portfolio-asset > div {
  min-width: 0;
}

.portfolio-asset strong,
.portfolio-asset > div > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-asset strong {
  color: var(--pf-ink);
  font-size: 12px;
  font-weight: 690;
}

.portfolio-asset > div > span {
  margin-top: 2px;
  color: var(--pf-muted);
  font-size: 10px;
}

.portfolio-mint {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 4px;
}

.portfolio-mint code {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #9497a0;
  font-family: Geist, Arial, sans-serif;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-mint button {
  padding: 0;
  background: none;
  color: var(--pf-cobalt);
  font-size: 9px;
  font-weight: 650;
}

.portfolio-amount,
.portfolio-market {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.portfolio-amount strong,
.portfolio-market strong {
  display: block;
  overflow: hidden;
  color: var(--pf-ink);
  font-size: 11px;
  font-weight: 670;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-amount strong {
  color: #c9d0ff;
}

.portfolio-verdict {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.portfolio-signal {
  display: block;
  overflow: hidden;
  color: #bfc8ff;
  font-size: 10px;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-signal.hidden {
  color: #eea28e;
}

.portfolio-signal.unknown {
  color: #c7c3b8;
}

.portfolio-verdict small {
  overflow: hidden;
  color: var(--pf-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-inspect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  min-width: 104px;
  padding: 0 8px;
  border: 1px solid #6977e3;
  border-radius: 4px;
  background: #4555cf;
  color: #fff !important;
  font-size: 10px;
  font-weight: 690;
}

.portfolio-inspect:hover {
  background: #5766e2;
}

.portfolio-inspect img {
  width: 12px;
  height: 12px;
}

.portfolio-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 16px;
  min-height: 38px;
  padding: 9px 15px;
  border-top: 1px solid var(--pf-rule);
  color: #92949a;
  font-size: 9px;
  line-height: 1.4;
}

.portfolio-empty {
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 230px;
  padding: 26px;
}

.portfolio-empty strong {
  color: var(--pf-ink);
  font-size: 15px;
  font-weight: 670;
}

.portfolio-empty p {
  max-width: 360px;
  margin: 8px 0 0;
  color: var(--pf-muted);
  font-size: 11px;
  line-height: 1.55;
}

.portfolio-empty button {
  min-height: 31px;
  margin-top: 16px;
  padding: 0 12px;
  border: 1px solid #6a78de;
  border-radius: 4px;
  background: #4555cf;
  color: #fff;
  font-size: 11px;
  font-weight: 650;
}

.portfolio-activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.portfolio-activity-item {
  padding: 14px 16px;
  border-bottom: 1px solid #303236;
}

.portfolio-activity-top,
.portfolio-activity-foot,
.portfolio-activity-change {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.portfolio-activity-outcome {
  color: #bfc8ff;
  font-size: 10px;
  font-weight: 700;
}

.portfolio-activity-outcome.failed {
  color: #eea28e;
}

.portfolio-activity-top time,
.portfolio-activity-foot,
.portfolio-activity-unknown {
  color: var(--pf-muted);
  font-size: 10px;
}

.portfolio-activity-changes {
  display: grid;
  gap: 5px;
  margin-top: 11px;
  padding: 9px 10px;
  border: 1px solid #393b40;
  border-radius: 4px;
  background: #242529;
}

.portfolio-activity-change span {
  overflow: hidden;
  color: #babcc3;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-activity-change strong {
  color: var(--pf-ink);
  font-size: 10px;
  font-weight: 660;
}

.portfolio-activity-foot {
  margin-top: 9px;
}

.portfolio-activity-foot a {
  color: var(--pf-cobalt);
  font-weight: 620;
}

.portfolio-activity-foot a:hover {
  text-decoration: underline;
}

.portfolio-disclosure {
  margin: 0;
  padding: 2px 2px 0;
  color: #98999e;
  font-size: 10px;
  line-height: 1.45;
}

@media (max-width: 1350px) {
  .portfolio-panels {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .portfolio-positions {
    min-height: 340px;
  }

  .portfolio-activity {
    min-height: 250px;
  }
}

@media (max-width: 760px) {
  .portfolio-workspace {
    padding: 14px 11px;
  }

  .portfolio-topline {
    align-items: start;
    flex-direction: column;
    gap: 13px;
  }

  .portfolio-controls {
    width: 100%;
    justify-content: start;
  }

  .portfolio-wallet {
    margin-right: auto;
  }

  .portfolio-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-summary > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--pf-rule);
  }

  .portfolio-summary > div:nth-child(4) {
    border-top: 1px solid var(--pf-rule);
  }

  .portfolio-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .portfolio-tools input {
    width: 100%;
  }

  .portfolio-search-wrap {
    flex: 1;
    min-width: 0;
  }

  .portfolio-position {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
    padding: 13px;
  }

  .portfolio-position.hidden {
    padding-left: 10px;
  }

  .portfolio-asset {
    grid-column: 1 / -1;
  }

  .portfolio-verdict {
    align-self: center;
  }

  .portfolio-inspect {
    justify-self: end;
    min-width: 86px;
  }
}

@media (max-width: 420px) {
  .portfolio-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-summary > div {
    padding: 11px;
  }

  .portfolio-summary strong {
    font-size: 16px;
  }

  .portfolio-summary .portfolio-summary-note {
    grid-column: 1 / -1;
    border-left: 0;
  }

  .portfolio-tools select {
    max-width: 140px;
  }
}

:root:not([data-theme="dark"]) .printer-frame #main:has(#portfolio-workspace:not([hidden])) {
  background: #fffcf5;
  color: #222c35;
  color-scheme: light;
}

:root:not([data-theme="dark"]) .portfolio-workspace {
  --pf-bg: #fffcf5;
  --pf-panel: #fffefb;
  --pf-panel-raised: #f5f0e5;
  --pf-rule: #e5ddce;
  --pf-ink: #222c35;
  --pf-muted: #66717b;
  --pf-soft: #76818a;
  --pf-cobalt: #3448c8;
  --pf-alert: #a8493a;
  color-scheme: light;
}

:root:not([data-theme="dark"]) .portfolio-title b {
  color: #a4a29c;
}

:root:not([data-theme="dark"]) .portfolio-controls button {
  border-color: #e0d9cd;
  background: #fff;
  color: #222c35;
}

:root:not([data-theme="dark"]) .portfolio-controls button:hover {
  background: #f5f0e5;
}

:root:not([data-theme="dark"]) .portfolio-controls button[data-open-wallets],
:root:not([data-theme="dark"]) .portfolio-empty button,
:root:not([data-theme="dark"]) .portfolio-inspect {
  border-color: #3448c8;
  background: #3448c8;
  color: #fff;
}

:root:not([data-theme="dark"]) .portfolio-controls button[data-open-wallets]:hover,
:root:not([data-theme="dark"]) .portfolio-empty button:hover,
:root:not([data-theme="dark"]) .portfolio-inspect:hover {
  background: #4459d6;
}

:root:not([data-theme="dark"]) .portfolio-summary .portfolio-summary-note {
  background: #f5f0e5;
}

:root:not([data-theme="dark"]) .portfolio-summary-note span {
  color: #596673;
}

:root:not([data-theme="dark"]) .portfolio-tools input,
:root:not([data-theme="dark"]) .portfolio-tools select {
  border-color: #ded7ca;
  background: #fff;
  color: #222c35;
}

:root:not([data-theme="dark"]) .portfolio-position {
  border-bottom-color: #ece5d9;
}

:root:not([data-theme="dark"]) .portfolio-position:hover,
:root:not([data-theme="dark"]) .portfolio-position:focus-within {
  background: #f9f6f0;
}

:root:not([data-theme="dark"]) .portfolio-position.hidden {
  border-left-color: #a8493a;
}

:root:not([data-theme="dark"]) .portfolio-asset-mark {
  border-color: #dcd7cd;
  background: #f5f0e5;
  color: #3e4b58;
}

:root:not([data-theme="dark"]) .portfolio-asset-mark.printer {
  border-color: #b5bde5;
  background: #f7f4eb;
}

:root:not([data-theme="dark"]) .portfolio-mint code,
:root:not([data-theme="dark"]) .portfolio-panel-foot,
:root:not([data-theme="dark"]) .portfolio-disclosure {
  color: #71808c;
}

:root:not([data-theme="dark"]) .portfolio-amount strong,
:root:not([data-theme="dark"]) .portfolio-signal,
:root:not([data-theme="dark"]) .portfolio-activity-outcome {
  color: #3448c8;
}

:root:not([data-theme="dark"]) .portfolio-signal.hidden,
:root:not([data-theme="dark"]) .portfolio-activity-outcome.failed {
  color: #a8493a;
}

:root:not([data-theme="dark"]) .portfolio-signal.unknown {
  color: #62717d;
}

:root:not([data-theme="dark"]) .portfolio-activity-item {
  border-bottom-color: #ece5d9;
}

:root:not([data-theme="dark"]) .portfolio-activity-changes {
  border-color: #e6ded1;
  background: #f7f3eb;
}

:root:not([data-theme="dark"]) .portfolio-activity-change span {
  color: #63717d;
}
