/* trader — the watch-along page.
 *
 * Dark, calm, text-forward, mobile-first. One column that never needs to be
 * wider than a phone; the desktop just gets more margin. No framework, no
 * fonts to fetch, nothing that fails when the harness is asleep. */

:root {
  --bg: #0d1117;
  --bg-raise: #151b23;
  --bg-sunk: #0a0e14;
  --line: #232c38;
  --line-strong: #33404f;
  --text: #e6edf3;
  --muted: #8d99a8;
  --faint: #5c6773;

  --up: #3fb950;
  --up-soft: rgb(63 185 80 / 0.13);
  --down: #f85149;
  --down-soft: rgb(248 81 73 / 0.13);
  --warn: #d29922;
  --warn-soft: rgb(210 153 34 / 0.14);
  --info: #58a6ff;
  --info-soft: rgb(88 166 255 / 0.13);
  --bear: #b07cc6;
  --bear-soft: rgb(176 124 198 / 0.1);

  --radius: 10px;
  --pad: 0.85rem;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  margin: 0 auto;
  padding: 0 0.9rem 5rem;
  max-width: 42rem;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* Numbers line up in columns; text does not. */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

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

/* ------------------------------------------------------------------ chrome */

header.top {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 1.1rem 0 0.2rem;
}

header.top h1 {
  margin: 0;
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header.top .role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

h2 {
  margin: 2rem 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

h2 .count {
  color: var(--faint);
  font-weight: 400;
  margin-left: 0.35rem;
}

.empty {
  color: var(--faint);
  font-size: 0.88rem;
  padding: 0.6rem 0;
  margin: 0;
}

/* ---------------------------------------------------------------- headline */

.headline {
  margin-top: 0.9rem;
  padding: 1.1rem var(--pad) 0.6rem;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.headline .equity {
  font-size: 2.5rem;
  line-height: 1.05;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
}

.headline .delta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
}

.headline .delta .pct {
  font-weight: 600;
}

.headline .delta .since {
  color: var(--faint);
  font-size: 0.8rem;
}

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

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

.flat {
  color: var(--muted);
}

.headline .split {
  display: flex;
  gap: 1.4rem;
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.headline .split b {
  display: block;
  color: var(--text);
  font-weight: 550;
  font-size: 0.95rem;
}

.chart {
  display: block;
  width: 100%;
  height: 88px;
  margin-top: 0.7rem;
  overflow: visible;
}

.chart .baseline {
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart .curve {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart .fill {
  stroke: none;
  opacity: 0.5;
}

.chart .dot {
  stroke: var(--bg-raise);
  stroke-width: 2;
}

.chart-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--faint);
  padding: 0.15rem 0 0.4rem;
}

/* -------------------------------------------------------------- pick cards */

.card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.55rem;
  overflow: hidden;
}

.card > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem var(--pad);
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  align-items: baseline;
  gap: 0.1rem 0.55rem;
}

.card > summary::-webkit-details-marker {
  display: none;
}

.card > summary:hover {
  background: rgb(255 255 255 / 0.02);
}

.card .rank {
  grid-row: span 2;
  align-self: center;
  color: var(--faint);
  font-size: 0.78rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1rem 0;
}

.card .ticker {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.card .headnum {
  text-align: right;
  font-size: 0.95rem;
  font-weight: 600;
}

.card .subline {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.chip {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.13rem 0.42rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chip-proposed { color: var(--warn); background: var(--warn-soft); border-color: rgb(210 153 34 / 0.3); }
.chip-approved { color: var(--info); background: var(--info-soft); border-color: rgb(88 166 255 / 0.3); }
.chip-declined { color: var(--faint); border-color: var(--line-strong); }
.chip-open { color: var(--up); background: var(--up-soft); border-color: rgb(63 185 80 / 0.3); }
.chip-closed { color: var(--muted); background: rgb(255 255 255 / 0.04); border-color: var(--line-strong); }

.chip-hold { color: var(--info); background: var(--info-soft); border-color: rgb(88 166 255 / 0.3); }
.chip-add { color: var(--up); background: var(--up-soft); border-color: rgb(63 185 80 / 0.3); }
.chip-trim { color: var(--warn); background: var(--warn-soft); border-color: rgb(210 153 34 / 0.3); }
.chip-exit { color: var(--down); background: var(--down-soft); border-color: rgb(248 81 73 / 0.3); }

.card .body {
  padding: 0.2rem var(--pad) var(--pad);
  border-top: 1px solid var(--line);
  margin-top: 0.1rem;
}

.field {
  margin: 0.8rem 0 0;
}

.field .label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-bottom: 0.15rem;
}

.field p {
  margin: 0;
  font-size: 0.92rem;
}

.levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.levels .lvl {
  flex: 1 1 8rem;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.levels .lvl .label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.levels .lvl b {
  font-weight: 600;
  font-size: 0.95rem;
}

/* The bear case is the required counter-argument, so it is the one block on
   the card that does not look like the rest of the card. */
.bear {
  margin-top: 0.9rem;
  padding: 0.6rem 0.75rem;
  background: var(--bear-soft);
  border: 1px solid rgb(176 124 198 / 0.28);
  border-left: 3px solid var(--bear);
  border-radius: 6px;
}

.bear .label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bear);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.bear p {
  margin: 0;
  font-size: 0.9rem;
}

/* The nightly verdict. */
.verdict {
  margin-top: 0.9rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.verdict .head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.verdict .head .date {
  font-size: 0.72rem;
  color: var(--faint);
  margin-left: auto;
}

.verdict p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

/* Position arithmetic. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.stats div {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
}

.stats .label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
}

.stats b {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Fills. */
.fills {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.fills li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

/* A fill is six short facts on a 390px screen; let the row wrap, but never
   break a date or a price down the middle. */
.fills li > span {
  white-space: nowrap;
}

.fills li:last-child {
  border-bottom: none;
}

.fills .side {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: 2.5rem;
}

.fills .side.buy { color: var(--up); }
.fills .side.sell { color: var(--down); }

.fills .when {
  color: var(--faint);
  font-size: 0.75rem;
  margin-left: auto;
}

/* ----------------------------------------------------------- closed rows */

.closed-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.55rem var(--pad);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.closed-row:last-child {
  border-bottom: none;
}

.closed-list {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.closed-row .ticker {
  font-weight: 650;
}

.closed-row .week {
  color: var(--faint);
  font-size: 0.75rem;
}

.closed-row .pl {
  margin-left: auto;
  font-weight: 600;
}

/* ------------------------------------------------------------ annotations */

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

.thread li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.thread li:last-child {
  border-bottom: none;
}

.thread .who {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.thread .who.owner { color: var(--up); }
.thread .who.watcher { color: var(--info); }

.thread .on {
  font-size: 0.7rem;
  color: var(--faint);
  margin-left: 0.4rem;
}

.thread .when {
  font-size: 0.7rem;
  color: var(--faint);
  float: right;
}

.thread p {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.thread-box {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.2rem var(--pad) 0.7rem;
}

.card .thread-box {
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 0.2rem 0 0;
  margin-top: 0.9rem;
}

/* ----------------------------------------------------------------- forms */

.compose-hint {
  font-size: 0.7rem;
  color: var(--faint);
  margin: 0.35rem 0 0;
}

form.compose {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

textarea,
input,
select {
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  width: 100%;
}

textarea {
  min-height: 3.4rem;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--info);
  outline-offset: -1px;
}

button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--text);
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  /* Thumb-sized on a phone. */
  min-height: 2.25rem;
}

button:hover:not(:disabled) {
  border-color: var(--muted);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.primary {
  background: var(--info-soft);
  border-color: rgb(88 166 255 / 0.45);
  color: var(--info);
}

button.approve {
  background: var(--up-soft);
  border-color: rgb(63 185 80 / 0.45);
  color: var(--up);
}

button.decline {
  background: var(--down-soft);
  border-color: rgb(248 81 73 / 0.4);
  color: var(--down);
}

button.link {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.2rem 0.3rem;
  font-size: 0.78rem;
  min-height: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

button.link:hover {
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.actions.right {
  justify-content: flex-end;
}

/* The owner's fill form: side + shares + price + date, all on one row on a
   phone that can take it, stacked on one that cannot. */
form.fill-form {
  margin-top: 0.7rem;
  padding: 0.65rem;
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

form.fill-form .row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

@media (min-width: 30rem) {
  form.fill-form .row {
    grid-template-columns: repeat(4, 1fr);
  }
}

form.fill-form label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  display: block;
  margin-bottom: 0.15rem;
}

/* ------------------------------------------------------------- gate/status */

.gate {
  margin: 5rem auto 0;
  max-width: 26rem;
  text-align: center;
  padding: 1.5rem var(--pad);
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.gate h1 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.gate p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 0.5rem;
}

.banner {
  margin-top: 0.7rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--warn-soft);
  border: 1px solid rgb(210 153 34 / 0.3);
  color: var(--warn);
}

.banner.bad {
  background: var(--down-soft);
  border-color: rgb(248 81 73 / 0.35);
  color: var(--down);
}

footer.foot {
  margin-top: 2.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--faint);
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

footer.foot .spacer {
  flex: 1;
}
