/* Shared client tokens and review components. Client styles own only their shells and interactions. */
:root {
  --app-font: "Times New Roman", "PingFang SC", serif;
  --review-paper: #f4f5ef;
  --review-surface: #fffefa;
  --review-ink: #243e33;
  --review-muted: #72816e;
  --review-line: #dfe5d8;
  --review-green: #205846;
  --review-soft: #edf2e8;
  --review-radius: 16px;
  --review-body-size: 16px;
}

body {
  font-family: var(--app-font);
}

/* Shared solid markers; selected colors contrast with the green date background. */
[data-pnl-day],
[data-pnl-month] {
  --pnl-day-dot: #9aa29e;
  --pnl-day-selected-dot: #bec6c1;
}
[data-pnl-result="profit"] {
  --pnl-day-dot: #30905a;
  --pnl-day-selected-dot: #55c58a;
}
[data-pnl-result="loss"] {
  --pnl-day-dot: #d25959;
  --pnl-day-selected-dot: #f07a7a;
}
[data-pnl-day]:not(:disabled)::after,
[data-pnl-month][data-pnl-result]::after,
.pnl-calendar-day.has-records::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pnl-day-dot);
}
[data-pnl-day].selected::after,
[data-pnl-day][aria-pressed="true"]::after,
[data-pnl-month][aria-pressed="true"]::after,
.pnl-calendar-day.has-records[aria-pressed="true"]::after {
  background: var(--pnl-day-selected-dot);
}

.pnl-view-switch {
  display: inline-flex;
  flex-shrink: 0;
  padding: 3px;
  border: 1px solid #d7dfd9;
  border-radius: 9px;
  background: #fffefa;
}
.pnl-view-switch button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 7px 11px;
  color: #61776a;
  font: 13px var(--app-font);
  white-space: nowrap;
  cursor: pointer;
}
.pnl-view-switch button[aria-pressed="true"] {
  background: var(--green);
  color: #fffefa;
}
.pnl-period-note {
  margin: -4px 0 10px;
  color: #87968b;
  font-size: 13px;
}

.review-page {
  --ink: var(--review-ink);
  --muted: var(--review-muted);
  --line: var(--review-line);
  --green: var(--review-green);
  color: var(--review-ink);
  background: var(--review-paper);
  font-family: var(--app-font);
}

.review-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--review-line);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.review-top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.review-icon-button,
.review-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--review-muted);
  font-size: 22px;
  cursor: pointer;
}

.review-icon-button:hover,
.review-menu summary:hover {
  background: var(--review-soft);
}

.review-menu {
  position: relative;
  flex: none;
}

.review-menu summary {
  list-style: none;
  letter-spacing: 2px;
}

.review-menu summary::-webkit-details-marker {
  display: none;
}

.review-menu-content {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 4;
  min-width: 148px;
  padding: 7px;
  border: 1px solid var(--review-line);
  border-radius: 12px;
  background: var(--review-surface);
  box-shadow: 0 8px 25px #253b301a;
}

.review-menu-content button {
  width: 100%;
  padding: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
}

.review-menu-content .pnl-position-menu-item,
.review-menu-content .review-block-contract {
  min-height: 44px;
  color: var(--review-green);
  white-space: nowrap;
}

.pnl-position-menu-item:focus-visible,
.review-block-contract:focus-visible {
  outline: 3px solid #a9c7b5;
  outline-offset: -3px;
}

.review-main {
  padding: 28px;
}

.review-eyebrow {
  display: block;
  margin-bottom: 20px;
  color: var(--review-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.review-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.review-identity .avatar {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 15px;
}

.review-identity-text {
  flex: 1;
  min-width: 0;
}

.review-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.review-name {
  white-space: normal;
  margin: 0;
  min-width: 0;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--review-ink);
  overflow-wrap: anywhere;
}

.review-subtitle {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--review-muted);
  overflow-wrap: anywhere;
}

.review-level-icon {
  margin-left: auto;
  width: 91px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 91px;
}

.review-refresh {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  background: transparent;
}

.review-refresh img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.review-facts {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-top: 22px;
  padding: 18px 0;
  border-bottom: 1px solid var(--review-line);
}

.review-context {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  min-width: 0;
}

.review-contract {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.review-chain-icon {
  display: block;
  width: auto;
  height: 24px;
  object-fit: contain;
  flex: none;
}

.review-address {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--review-ink);
  font-size: 12px;
  line-height: 1.5;
}

.review-address .address-label {
  color: var(--review-muted);
  font-size: 11px;
}

.review-address svg {
  width: 14px;
  height: 14px;
  color: var(--review-muted);
  flex: none;
}

.review-created {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  color: var(--review-muted);
  font-size: 12px;
  line-height: 1.5;
}

.review-quote {
  min-width: 0;
  max-width: 100%;
  color: var(--review-ink);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.review-created .created-label {
  color: inherit;
  font: inherit;
}

.review-ath {
  align-self: center;
  text-align: right;
}

.review-ath-label {
  display: block;
  margin-bottom: 5px;
  color: var(--review-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.review-ath-value {
  color: var(--review-green);
  font-size: 29px;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1.1;
}

.review-links {
  display: flex;
  gap: 9px;
  margin-top: 18px;
}

.review-market-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--review-line);
  border-radius: 10px;
  background: var(--review-surface);
  color: var(--review-green);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.review-market-link:hover {
  background: var(--review-soft);
}

.review-market-link svg {
  width: 16px;
  height: 16px;
}

.review-section {
  margin-top: 24px;
  padding-top: 23px;
  border-top: 1px solid var(--review-line);
}

.review-section-heading,
.review-content-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.review-content-heading {
  margin-top: 26px;
}

.review-section-heading h3,
.review-content-heading h3,
.review-content-heading label {
  margin: 0;
  color: var(--review-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.review-hint {
  color: var(--review-muted);
  font-size: 11px;
  line-height: 1.7;
}

.review-text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--review-green);
  font-size: 12px;
}

.review-tier-options {
  display: flex;
  gap: 8px;
}

.review-tier-options button {
  flex: 0 1 117px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--review-line);
  border-radius: 10px;
  background: var(--review-surface);
  color: var(--review-muted);
  font-size: 12px;
  white-space: nowrap;
}

.review-tier-options button[aria-pressed="true"] {
  border-color: var(--review-green);
  background: var(--review-green);
  color: #fff;
  font-weight: 600;
}

.review-tier-options button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.review-tag-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
}

.review-tag-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  flex: none;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--review-line);
  border-radius: 9px;
  background: var(--review-surface);
  color: var(--review-ink);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.review-prose {
  min-height: 120px;
  margin: 0;
  padding: 24px 25px;
  border: 1px solid var(--review-line);
  border-radius: var(--review-radius);
  background: var(--review-surface);
  overflow-wrap: anywhere;
}

.review-empty {
  padding: 18px 0;
  text-align: center;
  color: var(--review-muted);
}

.review-empty strong {
  display: block;
  color: var(--review-ink);
  font-size: 14px;
  font-weight: 500;
}

.review-empty p {
  margin: 5px 0 0;
  font-size: 12px;
}

.review-footer {
  margin: 23px 0 0;
  color: var(--review-muted);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-align: center;
}

/* The editor and both readers use identical document defaults. Inline author formatting remains intact. */
:is(.rich-content, .simple-editor) {
  color: #000000;
  font-family: var(--app-font);
  font-size: var(--review-body-size);
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

:is(.rich-content, .simple-editor) [data-typography] {
  font-family: var(--app-font) !important;
}

:is(.rich-content, .simple-editor) p {
  margin: 0 0 0.85em;
}

:is(.rich-content, .simple-editor) :is(h1, h2, h3, h4, h5, h6) {
  margin: 1.4em 0 0.45em;
  font-weight: 650;
  line-height: 1.35;
}

:is(.rich-content, .simple-editor) h1 {
  font-size: 2em;
}

:is(.rich-content, .simple-editor) h2 {
  font-size: 1.75em;
}

:is(.rich-content, .simple-editor) h3 {
  font-size: 1.25em;
}

:is(.rich-content, .simple-editor) :is(h4, h5, h6) {
  font-size: 1.1em;
}

:is(.rich-content, .simple-editor) > :first-child,
.rich-content > [data-typography] > :first-child {
  margin-top: 0;
}

:is(.rich-content, .simple-editor) > :last-child,
.rich-content > [data-typography] > :last-child {
  margin-bottom: 0;
}

:is(.rich-content, .simple-editor) :is(ul, ol) {
  margin: 0.85em 0;
  padding-left: 1.65em;
}

:is(.rich-content, .simple-editor) li {
  padding-left: 0.2em;
}

:is(.rich-content, .simple-editor) li + li {
  margin-top: 0.25em;
}

:is(.rich-content, .simple-editor) blockquote {
  margin: 18px 0;
  padding: 3px 0 3px 13px;
  border-left: 2px solid var(--review-green);
  background: transparent;
  color: var(--review-muted);
  font-size: 1em;
  line-height: inherit;
}

:is(.rich-content, .simple-editor) pre {
  margin: 1em 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--review-soft);
  overflow-x: auto;
  white-space: pre;
}

:is(.rich-content, .simple-editor) code {
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--review-soft);
  font-family: var(--app-font);
}

:is(.rich-content, .simple-editor) pre code {
  padding: 0;
  background: transparent;
}

:is(.rich-content, .simple-editor) table {
  max-width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
  font: inherit;
}

:is(.rich-content, .simple-editor) :is(th, td) {
  padding: 8px 12px;
  border: 1px solid var(--review-line);
  min-width: 40px;
}

:is(.rich-content, .simple-editor) th {
  background: var(--review-soft);
  font-weight: 700;
}

:is(.rich-content, .simple-editor) hr {
  margin: 1.5em 0;
  border: 0;
  border-top: 1px solid var(--review-line);
}

.rich-content font[size="2"] {
  font-size: 14px;
}

.rich-content a {
  color: var(--review-green);
  text-decoration: underline;
}
.rich-content ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0;
}
.rich-content li[data-type="taskItem"] {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.rich-content li[data-type="taskItem"]::before {
  content: "☐";
  color: var(--review-green);
}
.rich-content li[data-type="taskItem"][data-checked="true"]::before {
  content: "☑";
}

.rich-content font[size="3"] {
  font-size: 16px;
}

.rich-content font[size="4"] {
  font-size: 20px;
}

.rich-content font[size="5"] {
  font-size: 24px;
}

@media (max-width: 600px) {
  .review-main {
    padding: 22px 20px 26px;
  }

  .review-identity {
    gap: 12px;
  }

  .review-identity .avatar {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    border-radius: 14px;
  }

  .review-name {
    font-size: 24px;
  }

  .review-level-icon {
    width: 79px;
    height: 36px;
    flex-basis: 79px;
  }

  .review-facts {
    grid-template-columns: 1fr;
    gap: 17px;
    margin-top: 20px;
    padding: 0 0 18px;
  }

  .review-ath {
    grid-row: 1;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--review-soft);
    text-align: left;
  }

  .review-address {
    min-height: 32px;
  }

  .review-links {
    margin-top: 16px;
  }

  .review-market-link {
    flex: 1;
    min-height: 44px;
  }

  .review-section {
    margin-top: 22px;
    padding-top: 21px;
  }

  .review-tier-options {
    gap: 7px;
    flex-wrap: wrap;
  }

  .review-tier-options button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    min-height: 44px;
    padding: 0 4px;
  }

  .review-text-action {
    min-width: 44px;
    min-height: 44px;
  }

  .review-prose {
    padding: 20px 18px;
  }

  .review-icon-button,
  .review-menu summary,
  .review-refresh {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }
}

/* Display-only gold fold for collected PNL cards; absent on uncollected cards. */
.pnl-card > .pnl-collection-corner,
.meme-card[data-token-kind="pnl/tokens"] > .pnl-collection-corner {
  --pnl-corner-size: 44px;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: var(--pnl-corner-size);
  height: var(--pnl-corner-size);
  border-top-left-radius: inherit;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  background: linear-gradient(135deg, #fff3c3 2%, #e8cd8b 42%, #c8a45c 73%, #f9e8b5 100%);
  box-shadow: inset 1px 1px 0 #ffffff77;
  color: #8d692d;
  pointer-events: none;
}

.pnl-collection-corner > svg {
  position: absolute;
  top: calc(var(--pnl-corner-size) * 0.19);
  left: calc(var(--pnl-corner-size) * 0.19);
  width: calc(var(--pnl-corner-size) * 0.3);
  height: calc(var(--pnl-corner-size) * 0.3);
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.7;
  filter: drop-shadow(0 1px 0 #fff2c1);
}

.meme-card[data-token-kind="pnl/tokens"] {
  position: relative;
}

.meme-card[data-token-kind="pnl/tokens"] > .pnl-collection-corner {
  --pnl-corner-size: 32px;
}

/* Collection is a primary action; the filled star marks the saved state. */
.review-collection-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 156px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #205846;
  border-radius: 10px;
  background: #205846;
  box-shadow: 0 2px 5px #173f321a;
  color: #fffefa;
  font-family: var(--app-font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.review-collection-button:hover:not(:disabled) {
  border-color: #164432;
  background: #164432;
  box-shadow: 0 3px 9px #173f3229;
}

.review-collection-button:focus-visible {
  outline: 3px solid #a9c7b5;
  outline-offset: 3px;
}

.review-collection-button:disabled {
  opacity: 1;
  cursor: default;
}

.review-collection-button[data-collected="true"] {
  border-color: #d7c18a;
  background: #f2e6c6;
  box-shadow: none;
  color: #66501f;
  transition: none;
}

.review-collection-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.review-collection-button[data-collected="true"] .review-collection-icon {
  fill: #b98c27;
  stroke: #89651c;
}

.review-collection-loader {
  display: none;
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.review-collection-button[aria-busy="true"] .review-collection-icon {
  display: none;
}

.review-collection-button[aria-busy="true"] .review-collection-loader {
  display: block;
  animation: review-collection-spin 800ms linear infinite;
}

#collect-meme {
  min-height: 38px;
  margin-right: 8px;
}

.review-collect {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
}

@keyframes review-collection-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-collection-button {
    transition: none;
  }

  .review-collection-button[aria-busy="true"] .review-collection-loader {
    animation: none;
  }
}

/* Shared ATH threshold control for the PC and mobile PNL archives. */
.pnl-ath-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 248px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d3e0d8;
  border-radius: 12px;
  background: #fff;
  color: #345e50;
  font: 500 13px var(--app-font);
}
.pnl-ath-filter:focus-within {
  border-color: #257763;
  box-shadow: 0 0 0 3px rgb(37 119 99 / 10%);
}
.pnl-ath-filter label {
  flex-shrink: 0;
  margin: 0;
  white-space: nowrap;
}
.pnl-ath-filter label span {
  margin-left: 3px;
  color: #8c9b93;
}
.pnl-ath-filter input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: #164f40;
  font: 600 14px var(--app-font);
  font-variant-numeric: lining-nums tabular-nums;
  appearance: textfield;
}
.pnl-ath-filter input::-webkit-inner-spin-button,
.pnl-ath-filter input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}
.pnl-ath-filter input::placeholder {
  color: #96a39c;
  font-weight: 400;
}
.pnl-ath-unit {
  color: #8c9b93;
  font-size: 11px;
}
.pnl-ath-filter button {
  flex-shrink: 0;
  width: 24px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #edf4f0;
  color: #4b6e5e;
  font: 400 20px/1 var(--app-font);
  cursor: pointer;
}
.pnl-ath-filter button:hover {
  background: #dfebe4;
}
.pnl-ath-filter button:focus-visible {
  outline: 2px solid #257763;
  outline-offset: 2px;
}
#pnl-filters .pnl-ath-filter {
  grid-column: 1 / -1;
  width: 100%;
}

.pnl-profit-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 240px;
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  border: 1px solid #d3e0d8;
  border-radius: 12px;
  background: #fff;
  color: #345e50;
  font: 500 13px var(--app-font);
}
.pnl-profit-filter:focus-within {
  border-color: #257763;
  box-shadow: 0 0 0 3px rgb(37 119 99 / 10%);
}
.pnl-profit-filter label {
  flex-shrink: 0;
  margin: 0;
}
.pnl-profit-filter select {
  flex-shrink: 0;
  width: 58px;
  height: 30px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: #edf4f0;
  color: #345e50;
  font: inherit;
  cursor: pointer;
}
.pnl-profit-filter input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: #164f40;
  font: 600 14px var(--app-font);
  font-variant-numeric: lining-nums tabular-nums;
  appearance: textfield;
}
.pnl-profit-filter input::-webkit-inner-spin-button,
.pnl-profit-filter input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}
.pnl-profit-filter input::placeholder {
  color: #96a39c;
  font-weight: 400;
}
.pnl-profit-filter button {
  flex-shrink: 0;
  width: 24px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #edf4f0;
  color: #4b6e5e;
  font: 400 20px/1 var(--app-font);
  cursor: pointer;
}
.pnl-profit-filter button:hover {
  background: #dfebe4;
}
.pnl-profit-filter button:focus-visible,
.pnl-profit-filter select:focus-visible {
  outline: 2px solid #257763;
  outline-offset: 2px;
}
