:root {
  --background: #f6f7f9;
  --surface: #ffffff;
  --border: #d9dde3;
  --text: #1b2330;
  --muted: #5b6676;
  --accent: #2456c9;
  --accent-text: #ffffff;
  --wallet: #1b2330;
  --source: #1f8a5b;
  --destination: #c2571a;
  --both: #7a4bc4;
  --edge: #8792a2;
  --highlight: #d4a106;
  --warning-surface: #fff6dc;
  --warning-border: #e2c463;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #12161c;
    --surface: #1b2129;
    --border: #2f3844;
    --text: #e6eaf0;
    --muted: #9aa5b4;
    --accent: #6f9bff;
    --accent-text: #0e1420;
    --wallet: #e6eaf0;
    --source: #4fc48e;
    --destination: #f0935a;
    --both: #b08cf0;
    --edge: #7c8798;
    --highlight: #f2c94c;
    --warning-surface: #2e2a18;
    --warning-border: #6d5f24;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 {
  margin: 0 0 12px;
  font-size: 20px;
}

h2 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.top {
  padding: 16px 20px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.lookup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.lookup label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.lookup .grow {
  flex: 1 1 320px;
}

input[type="text"],
select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: inherit;
}

input[type="text"] {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
}

button {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--accent);
}

button.small {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.clickable li:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.top[hidden] {
  display: none;
}

.account {
  margin: 0 0 14px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

.account-row + .account-row {
  margin-top: 8px;
  align-items: center;
}

.account-row[hidden],
.account [hidden] {
  display: none;
}

.account label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.account label.check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.account input[type="email"] {
  min-width: 260px;
}

.account .status {
  margin-top: 6px;
}

.saved {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.saved li {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.saved button {
  height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.saved button.remove {
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
}

button.danger {
  border-color: var(--destination);
  color: var(--destination);
}

#confirm-header .lead {
  max-width: 70ch;
  margin: 0 0 14px;
}

.sample-intro h1 {
  font-size: 24px;
  max-width: 34ch;
}

.sample-intro .lead {
  max-width: 78ch;
  margin: 0 0 14px;
}

.sample-intro .muted {
  max-width: 78ch;
  margin-top: 8px;
}

.sample-flag {
  display: inline-block;
  margin: 0 0 10px;
  padding: 2px 10px;
  border: 1px solid var(--warning-border);
  border-radius: 12px;
  background: var(--warning-surface);
  font-size: 13px;
  font-weight: 600;
}

/* A field people never see. Automated form-fillers fill it in and give
   themselves away. */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

input[type="email"] {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font: inherit;
}

.status.success {
  color: var(--source);
  font-weight: 600;
}

.status {
  margin: 10px 0 0;
  color: var(--muted);
}

.status.error {
  color: var(--destination);
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  padding: 16px 20px 24px;
  align-items: start;
}

.layout[hidden] {
  display: none;
}

.map-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.map-legend button:first-of-type {
  margin-left: auto;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.swatch.source {
  background: var(--source);
}

.swatch.destination {
  background: var(--destination);
}

.swatch.both {
  background: var(--both);
}

.swatch.wallet {
  background: var(--wallet);
}

.map {
  position: relative;
  height: 62vh;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
}

.note {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  background: var(--warning-surface);
  font-size: 13px;
}

.timeline {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.timeline input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.timeline output {
  min-width: 230px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.panel.always {
  border-color: var(--warning-border);
  background: var(--warning-surface);
}

.panel h2:not(:first-child) {
  margin-top: 12px;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 0;
  font-size: 14px;
}

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

.facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.plain {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.plain li {
  padding: 5px 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.plain li:first-child {
  border-top: 0;
}

.clickable li {
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
}

.clickable li:hover {
  background: var(--background);
}

.clickable li.active {
  background: var(--background);
  box-shadow: inset 3px 0 0 var(--highlight);
}

.pnl-total {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.gain {
  color: var(--source);
}

.loss {
  color: var(--destination);
}

.pnl-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.pnl-row strong {
  white-space: nowrap;
}

.notes {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.notes summary {
  cursor: pointer;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 6px;
}

.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.evidence {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
}

.evidence th,
.evidence td {
  text-align: left;
  padding: 4px 6px 4px 0;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

.evidence th {
  color: var(--muted);
  font-weight: 600;
  border-top: 0;
}

.evidence td.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.tag {
  display: inline-block;
  padding: 0 6px;
  margin-right: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
}

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

  .timeline output {
    min-width: 0;
  }
}

/* ---------------------------------------------------------------- extra views */

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.view-switch button.active {
  background: var(--accent);
  color: var(--accent-text);
}

#map-view[hidden],
#other-view[hidden] {
  display: none;
}

.asset-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.asset-pick select {
  height: 30px;
  max-width: 220px;
}

.muted-inline {
  flex-basis: 100%;
}

.views {
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  padding: 10px;
  overflow-x: auto;
}

.view-drawing {
  display: block;
  min-width: 640px;
}

.view-drawing text {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.view-name {
  fill: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.view-detail {
  fill: var(--muted);
  font-size: 12.5px;
}

.view-wallet {
  fill: var(--wallet);
}

.view-node.in,
.view-bar.in {
  fill: var(--source);
}

.view-node.out,
.view-bar.out {
  fill: var(--destination);
}

.view-ribbon {
  opacity: 0.45;
  transition: opacity 0.15s;
}

.view-ribbon.in {
  fill: var(--source);
}

.view-ribbon.out {
  fill: var(--destination);
}

.view-ribbon.others,
.view-spoke.others,
.rank-fill.others {
  fill: var(--edge);
  stroke: var(--edge);
  background: var(--edge);
}

.view-spoke {
  stroke-linecap: round;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.view-spoke.in {
  stroke: var(--source);
}

.view-spoke.out {
  stroke: var(--destination);
}

.view-axis {
  stroke: var(--muted);
  stroke-width: 1;
}

.view-grid {
  stroke: var(--border);
  stroke-dasharray: 3 3;
}

.view-target {
  cursor: pointer;
  outline: none;
}

.view-ribbon.view-target:hover,
.view-ribbon.view-target:focus-visible,
.view-spoke.view-target:hover,
.view-spoke.view-target:focus-visible {
  opacity: 0.85;
}

.view-bar.view-target:hover,
.view-bar.view-target:focus-visible,
.view-node.view-target:hover,
.view-node.view-target:focus-visible {
  stroke: var(--highlight);
  stroke-width: 2;
}

.view-empty {
  padding: 20px;
}

.rank {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.rank h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

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

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.rank-row:hover,
.rank-row:focus-visible {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--highlight);
}

.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-track {
  display: block;
  height: 12px;
}

.rank-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.rank-fill.in {
  background: var(--source);
}

.rank-fill.out {
  background: var(--destination);
}

.rank-amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}

.caution {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid #b7791f;
  background: #fdf6e3;
  color: #5c4310;
  font-size: 0.9rem;
}

/* MyCryptoWalletScore integration: white surfaces and forest-green accents. */
:root {
  color-scheme: light;
  --background: #fff;
  --surface: #fff;
  --border: #e2e5e0;
  --text: #242824;
  --muted: #626962;
  --accent: #315e4d;
  --accent-text: #fff;
  --wallet: #242824;
  --source: #315e4d;
  --destination: #9a643d;
  --both: #6c6590;
  --edge: #9ca7a0;
  --highlight: #315e4d;
  --warning-surface: #faf7ed;
  --warning-border: #dfd2ab;
}
body { font-family: Arial, Helvetica, sans-serif; }
.integrated-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
  padding: 28px 48px;
  border-bottom: 1px solid var(--border);
}
.integrated-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .85rem;
}
.integrated-brand { margin-right: 25px; }
.integrated-brand img { width: 260px; height: auto; max-width: 75vw; }
.integrated-nav strong { color: var(--accent); font-size: .85rem; font-weight: 400; }
.integrated-mode {
  margin-left: auto;
  border: 1px solid var(--border);
  padding: 7px 10px;
  font-size: .7rem;
  color: var(--muted);
}
.top { padding: 38px 48px; background: #fff; }
h1, h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -.035em;
}
h1 { font-size: clamp(2rem, 3.6vw, 2.8rem); }
h2 { font-size: 1.25rem; text-transform: none; }
.integrated-lead {
  font: 1.2rem/1.65 Georgia, 'Times New Roman', serif;
  max-width: 740px;
  color: #4d554f;
}
.integrated-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 24px 0;
  color: var(--muted);
  font-size: .8rem;
}
.panel { border-radius: 4px; box-shadow: none; }
.layout { padding: 24px 48px; }
.coverage-summary {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  background: #f5f8f5;
  color: var(--accent);
}
.view-switch button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
@media (max-width: 650px) {
  .integrated-nav { padding: 20px; gap: 15px; }
  .integrated-mode { margin-left: 0; }
  .top { padding: 26px 20px; }
  .layout { padding: 16px; }
  .integrated-brand { margin-right: 0; }
}

/* The shell, navigation, brand and page typography share the explorer stylesheet. */
.site-header nav { flex-wrap: wrap; }
.top, main.layout {
  margin-left: clamp(48px, 6.5vw, 100px);
  max-width: 1160px;
  width: calc(100% - clamp(48px, 6.5vw, 100px) - 48px);
  padding: 36px 0 24px;
  border: 0;
}
.top h1 { line-height: 1.2; margin-bottom: 22px; }
.top .integrated-lead { margin: 0; font: 1.28rem/1.65 Georgia, serif; }
.lookup input, .lookup select {
  min-height: 50px;
  background: #fafbf9;
  border-radius: 4px;
}
#load { background: #242c27; color: #fff; border: 0; height: 50px; }
#show-demo { border: 0; padding: 0; text-decoration: underline; text-underline-offset: 4px; }
main.layout { gap: 30px; padding-top: 12px; }
.layout .panel, .layout .map-area {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 22px 0;
  background: var(--panel);
}
.layout h2 { color: var(--text); font: 1.5rem/1.3 Georgia, serif; }
.profit-panel { grid-column: 1 / -1; }
.profit-panel .pnl-total {
  margin: 12px 0 6px;
  color: var(--text);
  font: 3rem/1.1 Georgia, serif;
  letter-spacing: -.045em;
}
#pnl-summary > p:not(.pnl-total) { max-width: 75ch; font-size: .85rem; }
.profit-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; }
.profit-figure { margin: 12px 0 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.profit-figure figcaption { margin-bottom: 12px; font: 1.2rem Georgia, serif; }
.profit-chart-row {
  display: grid;
  grid-template-columns: minmax(65px, 1fr) minmax(45px, 2fr) minmax(65px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  height: auto;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: .8rem;
  font-weight: 400;
}
.profit-chart-row > span:first-child { overflow-wrap: anywhere; }
.profit-chart-row strong { font-weight: 500; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
button.profit-chart-row:hover { background: #f3f6f2; }
button.profit-chart-row > span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.profit-track { position: relative; height: 20px; border-bottom: 1px solid var(--line); }
.profit-bar { position: absolute; top: 5px; height: 10px; background: var(--accent); }
.profit-bar.negative { background: repeating-linear-gradient(120deg, #8e5b43 0 3px, #d6b6a5 3px 5px); }
.profit-bar.net { background: #242c27; }
.profit-zero { position: absolute; top: 1px; bottom: 0; border-left: 1px solid #777f78; }
#profit-details, .profit-panel .notes { margin-top: 12px; }
@media (max-width: 950px) {
  .top, main.layout { margin-left: 32px; width: calc(100% - 64px); }
}
@media (max-width: 650px) {
  .top, main.layout { margin-left: 24px; width: calc(100% - 48px); }
  .site-header nav { column-gap: 16px; }
  .profit-charts { grid-template-columns: 1fr; gap: 0; }
}

.guide-entry { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.guide-entry .coverage-summary { flex: 1 1 240px; }
#explain-profit { color: var(--accent); background: none; border: 0; padding: 0; }
#report-guide { box-sizing: border-box; width: min(520px, 94vw); max-height: 85vh; padding: 24px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface); }
#report-guide[open] { display: flex; flex-direction: column; gap: 14px; }
#report-guide::backdrop { background: rgb(23 33 27 / 35%); }
#report-guide header { display: flex; align-items: center; justify-content: space-between; }
#report-guide h2, #guide-context { margin: 0; }
#guide-context { overflow-wrap: anywhere; color: var(--muted); font-size: .8rem; }
#guide-history { overflow: auto; overscroll-behavior: contain; }
#guide-history article { padding: 16px 0; border-top: 1px solid var(--border); font-size: .88rem; }
#guide-history h3 { font-weight: 600; margin: 0; }
#guide-history summary { color: var(--accent); padding: 6px 0; }
.guide-questions { display: flex; gap: 8px; flex-wrap: wrap; }
#guide-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
#guide-composer label, #guide-status { grid-column: 1 / -1; }
#guide-status:empty { display: none; }
#guide-history article { overflow-wrap: anywhere; }
.guide-questions button { height: auto; padding: 8px 10px; background: white; color: var(--accent); border: 1px solid var(--border); }
#report-guide { width: min(620px, 94vw); padding: clamp(16px, 4vw, 32px); border: 1px solid var(--line); border-radius: 0; background: var(--panel); }
#report-guide header { position: static; padding: 0; background: transparent; border: none; }
#report-guide header .eyebrow { margin: 0 0 6px; color: var(--lime); }
#guide-title { font: normal clamp(1.7rem, 5vw, 2.4rem) Georgia, serif; letter-spacing: -.035em; }
#report-guide header button, .guide-questions button { background: transparent; color: var(--lime); border: 0; padding: 5px 0; text-decoration: underline; text-underline-offset: 4px; }
.guide-questions { column-gap: 16px; }
#guide-composer { border-top: 1px solid var(--line); padding-top: 12px; }
#guide-composer button { background: var(--lime); color: #fff; border-radius: 3px; }
.guide-transaction { padding: 9px 0; border-bottom: 1px solid var(--line); }
.guide-transaction small, .guide-transaction a { color: var(--muted); font: .72rem monospace; overflow-wrap: anywhere; }
