/* Classic Lab — Differential Virtual Treasury (sim profit-recycling) control */
#treasury-host {
  display: block;
  margin: 0 0 14px;
}

.tre-card {
  position: relative;
  border: 1px solid rgba(255, 205, 110, 0.35);
  border-radius: 14px;
  padding: 16px 18px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 190, 80, 0.16), transparent 60%),
    radial-gradient(120% 140% at 100% 0%, rgba(0, 230, 180, 0.1), transparent 55%),
    linear-gradient(180deg, rgba(26, 22, 14, 0.92), rgba(18, 15, 10, 0.92));
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.tre-card.tre-on {
  border-color: rgba(255, 205, 110, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 205, 110, 0.25), 0 8px 30px rgba(80, 60, 0, 0.35);
}

.tre-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tre-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1a1206;
  background: linear-gradient(90deg, #ffd779, #ffb454);
  padding: 3px 9px;
  border-radius: 999px;
}
.tre-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff6e6;
}
.tre-state {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #d6c39f;
  border: 1px solid rgba(230, 205, 160, 0.3);
  padding: 3px 9px;
  border-radius: 999px;
}
.tre-card.tre-on .tre-state {
  color: #1a1206;
  background: #ffcd6e;
  border-color: transparent;
}

.tre-blurb {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: #ece0cc;
}
.tre-blurb b {
  color: #fff6e6;
}

.tre-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
}
.tre-engage {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #1a1206;
  background: linear-gradient(90deg, #ffd779, #ffb454);
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.tre-engage:hover {
  filter: brightness(1.06);
}
.tre-engage:active {
  transform: translateY(1px);
}

.tre-paces {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tre-paces-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #c9b88f;
}
.tre-pace {
  font-size: 11.5px;
  font-weight: 700;
  color: #ece0cc;
  background: rgba(255, 220, 150, 0.06);
  border: 1px solid rgba(230, 205, 160, 0.28);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}
.tre-pace.on {
  color: #1a1206;
  background: #ffcd6e;
  border-color: transparent;
}

.tre-btn {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border: 1px solid rgba(230, 205, 160, 0.3);
}
.tre-go {
  color: #1a1206;
  background: linear-gradient(90deg, #ffd779, #ffb454);
  border: 0;
}
.tre-ghost {
  color: #ece0cc;
  background: rgba(255, 220, 150, 0.06);
}
.tre-reset {
  font-weight: 700;
}

.tre-status {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}
.tre-chip {
  font-size: 11.5px;
  font-weight: 700;
  color: #d6c39f;
  background: rgba(255, 220, 150, 0.07);
  border: 1px solid rgba(230, 205, 160, 0.22);
  border-radius: 999px;
  padding: 4px 10px;
}
.tre-chip.live {
  color: #1a1206;
  background: #ffcd6e;
  border-color: transparent;
}
.tre-chip.off {
  color: #c9b88f;
}

.tre-bar {
  flex: 1 1 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 220, 150, 0.12);
  overflow: hidden;
  margin-top: 6px;
}
.tre-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd779, #ffb454);
  transition: width 0.4s ease;
}

/* live buffer-over-session sparkline */
.tre-spark {
  margin: 10px 0 0;
}
.tre-spark-empty {
  font-size: 11.5px;
  line-height: 1.5;
  color: #b8a884;
}
.tre-spark-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.tre-spark-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9b88f;
}
.tre-spark-now {
  font-size: 11.5px;
  font-weight: 800;
  color: #ffcd6e;
}
.tre-spark-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 220, 150, 0.06);
  border: 1px solid rgba(230, 205, 160, 0.22);
}
.tre-spark-tab {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #d6c39f;
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
}
.tre-spark-tab.on {
  color: #1a1206;
  background: #ffcd6e;
}
.tre-spark-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.tre-spark-range {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #d6c39f;
  background: rgba(255, 220, 150, 0.06);
  border: 1px solid rgba(230, 205, 160, 0.22);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
}
.tre-spark-range:hover {
  border-color: rgba(255, 205, 110, 0.5);
}
.tre-spark-range.on {
  color: #1a1206;
  background: #ffcd6e;
  border-color: #ffcd6e;
}
.tre-spark-foot {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.4;
  color: #b8a884;
}
.tre-export {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.tre-export-label {
  font-size: 10.5px;
  line-height: 1.4;
  color: #b8a884;
}
.tre-export-btn {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ece0cc;
  background: rgba(255, 220, 150, 0.07);
  border: 1px solid rgba(230, 205, 160, 0.28);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.tre-export-btn:hover {
  filter: brightness(1.12);
}
.tre-export-btn:active {
  transform: translateY(1px);
}
.tre-export-btn[hidden] {
  display: none;
}
.tre-copy-cmp {
  color: #d8e9d2;
  background: rgba(150, 230, 170, 0.09);
  border-color: rgba(160, 220, 175, 0.34);
}
.tre-copy-table {
  color: #d2e3e9;
  background: rgba(150, 200, 230, 0.09);
  border-color: rgba(160, 200, 220, 0.34);
}
.tre-copy-md {
  color: #e3d6ea;
  background: rgba(200, 160, 230, 0.09);
  border-color: rgba(200, 165, 220, 0.34);
}
/* The member's remembered one-tap copy format reads as the primary control:
   a brighter fill + glowing ring so it's the obvious first tap, while the other
   format stays right beside it. */
.tre-copy-primary {
  filter: brightness(1.18);
  box-shadow: 0 0 0 1px rgba(255, 226, 158, 0.55),
    0 2px 9px rgba(0, 0, 0, 0.28);
  font-weight: 900;
}
.tre-spark-svg {
  display: block;
  width: 100%;
  height: 46px;
  overflow: visible;
}

/* hover/tap read-out layer over the curve */
.tre-spark-plot {
  position: relative;
  cursor: crosshair;
  touch-action: pan-y;
}
.tre-spark-cursor,
.tre-spark-dot,
.tre-spark-tip,
.tre-spark-pin-cursor,
.tre-spark-pin-dot {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.tre-spark-plot.tre-spark-hover .tre-spark-cursor,
.tre-spark-plot.tre-spark-hover .tre-spark-dot,
.tre-spark-plot.tre-spark-hover .tre-spark-tip {
  opacity: 1;
}
/* pinned anchors stay visible whether or not the pointer is over the plot */
.tre-spark-plot.tre-spark-pin-a .tre-spark-pin-cursor.pinA,
.tre-spark-plot.tre-spark-pin-a .tre-spark-pin-dot.pinA,
.tre-spark-plot.tre-spark-pin-b .tre-spark-pin-cursor.pinB,
.tre-spark-plot.tre-spark-pin-b .tre-spark-pin-dot.pinB {
  opacity: 1;
}
.tre-spark-cursor {
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: rgba(255, 205, 110, 0.55);
}
.tre-spark-dot {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #ffcd6e;
  box-shadow: 0 0 0 2px rgba(26, 18, 6, 0.85);
}
.tre-spark-tip {
  top: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  font-size: 10.5px;
  line-height: 1.3;
  background: rgba(26, 18, 6, 0.94);
  border: 1px solid rgba(255, 205, 110, 0.4);
  border-radius: 7px;
  padding: 3px 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.tre-tip-d {
  color: #d6c39f;
  font-weight: 700;
}
.tre-tip-v {
  color: #ffcd6e;
  font-weight: 800;
}
.tre-tip-peak {
  color: #b7a279;
  font-weight: 600;
}
/* delta read-out colours when comparing a pinned point to a hovered one */
.tre-tip-pct {
  font-weight: 700;
}
.tre-tip-up {
  color: #7ee0b0;
}
.tre-tip-down {
  color: #e79a6a;
}
.tre-tip-flat {
  color: #d6c39f;
}

/* persistent pinned-anchor marker (distinct from the live hover dot) */
.tre-spark-pin-cursor {
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: rgba(126, 224, 176, 0.6);
  border-left: 1px dashed rgba(126, 224, 176, 0.85);
}
.tre-spark-pin-dot {
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid #7ee0b0;
  box-shadow: 0 0 0 2px rgba(26, 18, 6, 0.85);
}
/* the second locked endpoint reads in a distinct cool hue from the first */
.tre-spark-pin-cursor.pinB {
  background: rgba(157, 180, 255, 0.6);
  border-left: 1px dashed rgba(157, 180, 255, 0.85);
}
.tre-spark-pin-dot.pinB {
  border-color: #9db4ff;
}

/* persistent A→B comparison read-out — stays on screen once both ends pinned */
.tre-spark-compare {
  display: none;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  padding: 5px 9px;
  font-size: 11px;
  line-height: 1.3;
  border-radius: 8px;
  background: rgba(26, 18, 6, 0.55);
  border: 1px solid rgba(255, 205, 110, 0.22);
}
.tre-spark-compare.on {
  display: flex;
}
.tre-cmp-hint {
  color: #b8a884;
}
.tre-cmp-hint b {
  color: #d6c39f;
}
.tre-cmp-span {
  color: #d6c39f;
  font-weight: 700;
}
.tre-cmp-v {
  font-weight: 800;
}
.tre-cmp-pct {
  font-weight: 700;
}
.tre-cmp-clear,
.tre-cmp-copy {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ece0cc;
  background: rgba(255, 220, 150, 0.07);
  border: 1px solid rgba(230, 205, 160, 0.3);
  border-radius: 999px;
  padding: 2px 9px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.tre-cmp-clear:hover,
.tre-cmp-copy:hover {
  filter: brightness(1.12);
}
.tre-cmp-clear:active,
.tre-cmp-copy:active {
  transform: translateY(1px);
}
/* When both the Copy-link and Clear controls share the locked read-out, only
   the Copy button absorbs the free space (margin-left:auto); Clear then sits
   immediately to its right so the pair reads as one "Copy link · Clear" group. */
.tre-cmp-locked .tre-cmp-copy {
  margin-left: auto;
}
.tre-cmp-locked .tre-cmp-clear {
  margin-left: 0;
}
.tre-cmp-copy.is-copied {
  color: #0d2c12;
  background: rgba(126, 234, 156, 0.92);
  border-color: rgba(126, 234, 156, 0.92);
}
.tre-cmp-copy.is-copyfail {
  color: #ffd9c2;
  border-color: rgba(255, 150, 110, 0.6);
}
.tre-spark-line {
  fill: none;
  stroke: #ffcd6e;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.tre-spark-area {
  fill: rgba(255, 205, 110, 0.14);
  stroke: none;
}
.tre-spark-down .tre-spark-line {
  stroke: #e7b67a;
}

.tre-math {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #b8a884;
}
.tre-lock-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: #d6c39f;
}
.tre-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}
.tre-fine {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #9c8e6e;
}
