/* ============================================================================
   DailyScalper — "The Ledger"
   Financial broadsheet meets trading terminal. Editorial serif for authority,
   monospace tabular figures for anything a reader might check. Colour is
   reserved for real signal: green = measured gain, red = measured risk.
   ========================================================================== */

:root {
  --ink: #070c12;
  --panel: #0e1721;
  --panel-2: #142131;
  --rule: #1e3242;
  --rule-soft: #16283698;

  --text: #e7eef5;
  --text-dim: #93a7ba;
  --text-faint: #5d7186;

  --gold: #c9a227;
  --green: #2fbf71;
  --green-deep: #17603a;
  --red: #e5484d;
  --amber: #d9a441;

  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --maxw: 1240px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain — keeps large dark fields from looking flat/digital */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------------ layout */

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.rule-top { border-top: 1px solid var(--rule); }

section { position: relative; z-index: 2; }

/* ------------------------------------------------------------- typography */

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; line-height: 1.05; margin: 0; }

h1 { font-size: clamp(2.9rem, 7.5vw, 5.6rem); }
h2 { font-size: clamp(2rem, 4.2vw, 3.2rem); }
h3 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }

p { margin: 0 0 1rem; }

.lede {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--text-dim);
  max-width: 62ch;
}

/* Small caps label — the broadsheet's section marker */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.pos { color: var(--green); }
.neg { color: var(--red); }
.dim { color: var(--text-dim); }

/* ---------------------------------------------------------------- masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 0.9rem;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
.wordmark span { color: var(--gold); }

.masthead nav {
  display: flex;
  gap: 1.75rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.masthead nav a { position: relative; padding-block: 0.25rem; transition: color 0.2s; }
.masthead nav a:hover { color: var(--text); }
.masthead nav a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--gold);
  transition: width 0.25s ease;
}
.masthead nav a:hover::after { width: 100%; }

/* Small-screen menu: same links, opened from a <details> toggle. */
.menu { display: none; position: relative; }
.menu summary {
  list-style: none; cursor: pointer; padding: 0.45rem 0.9rem; border: 1px solid var(--rule); border-radius: 999px;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim);
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--gold); color: var(--text); }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 0.6rem); min-width: 220px; display: flex !important; flex-direction: column;
  gap: 0 !important; padding: 0.5rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.45);
}
.menu__panel a { padding: 0.75rem 0.85rem !important; border-radius: 8px; font-size: 1rem; }
.menu__panel a::after { display: none; }
.menu__panel a:hover, .menu__panel a[aria-current='page'] { background: var(--panel-2); }

@media (max-width: 800px) {
  .masthead > .masthead__inner > nav { display: none; }
  .menu { display: block; }
}

/* -------------------------------------------------------------------- hero */

.hero { padding-block: clamp(4rem, 11vw, 8.5rem) clamp(3rem, 7vw, 5rem); position: relative; overflow: hidden; }

/* Faint ruled grid, like ledger paper */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--rule-soft) 1px, transparent 1px);
  background-size: 100% 2.6rem;
  mask-image: linear-gradient(to bottom, transparent, #000 30%, transparent 92%);
  opacity: 0.5;
}

/* Keeps the 1240px container so the hero stays left-aligned with the masthead;
   the reading measure is set on the children instead. */
.hero__inner { position: relative; z-index: 2; }
.hero h1 { margin-bottom: 1.5rem; max-width: 18ch; }
.hero .lede { max-width: 56ch; }
.hero h1 em { font-style: italic; color: var(--gold); }

.hero__meta {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.hero__meta div { display: flex; flex-direction: column; gap: 0.3rem; }
.hero__meta dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hero__meta dd { margin: 0; font-family: var(--mono); font-size: 1.5rem; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ button */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.95rem 1.6rem;
  border: 1px solid transparent;
  transition: transform 0.18s ease, background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--green); color: #04150c; font-weight: 600; }
.btn--primary:hover { background: #43d585; }
.btn--ghost { border-color: var(--rule); color: var(--text-dim); }
.btn--ghost:hover { border-color: var(--gold); color: var(--text); }

.btn-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.5rem; }

/* ------------------------------------------------------------------ panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

.grid-2 { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid-3 { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.block { padding-block: clamp(3.5rem, 8vw, 6rem); }

/* ------------------------------------------------------------ ranking table */

.ledger { width: 100%; border-collapse: collapse; font-size: 0.92rem; }

.ledger thead th {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: right;
  font-weight: 400;
  padding: 0 0.75rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.ledger thead th:first-child,
.ledger thead th:nth-child(2) { text-align: left; }

.ledger tbody tr {
  border-bottom: 1px solid var(--rule-soft);
  transition: background 0.18s;
}
.ledger tbody tr:hover { background: var(--panel-2); }

.ledger td {
  padding: 1rem 0.75rem;
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ledger td:first-child,
.ledger td:nth-child(2) { text-align: left; }

.rank {
  font-family: var(--serif);
  font-size: 1.9rem;
  color: var(--gold);
  line-height: 1;
  width: 3rem;
}

.trader-name { font-family: var(--sans); font-weight: 600; font-size: 1rem; }
.trader-sub { font-family: var(--mono); font-size: 0.72rem; color: var(--text-faint); }

.table-scroll { overflow-x: auto; }

/* sparkline */
.spark { display: block; width: 92px; height: 26px; }
.spark path { fill: none; stroke: var(--green); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark.is-neg path { stroke: var(--red); }

/* ------------------------------------------------------- screening ledger */

/* The differentiator: we publish what we threw out, and why. */
.screen-stat {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--rule-soft);
}
.screen-stat b {
  font-family: var(--mono);
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
}
.screen-stat span { color: var(--text-dim); font-size: 0.92rem; }

.reject-list { list-style: none; margin: 0; padding: 0; }
.reject-list li {
  display: flex;
  gap: 1rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.88rem;
  align-items: baseline;
}
.reject-list .why { color: var(--red); font-family: var(--mono); font-size: 0.78rem; }
.reject-list .who { font-weight: 600; min-width: 9rem; }

/* ------------------------------------------------------------------ gates */

.gate {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding-block: 0.8rem;
  border-bottom: 1px solid var(--rule-soft);
}
.gate__mark { color: var(--gold); font-family: var(--mono); font-size: 0.8rem; padding-top: 0.2rem; }
.gate__body strong { display: block; font-size: 0.95rem; margin-bottom: 0.15rem; }
.gate__body span { color: var(--text-dim); font-size: 0.86rem; }

/* ------------------------------------------------------------------ badges */

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--rule);
  color: var(--text-dim);
}
.tag--rf { border-color: #2a4a6b; color: #7fb2e5; }
.tag--lf { border-color: #4a3a6b; color: #b79ce5; }
.tag--warn { border-color: var(--amber); color: var(--amber); }

/* ------------------------------------------------------------------ footer */

.footer {
  border-top: 1px solid var(--rule);
  padding-block: 3rem 2rem;
  color: var(--text-faint);
  font-size: 0.85rem;
  position: relative;
  z-index: 2;
}
.footer a:hover { color: var(--text); }
.footer__cols { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 2.5rem; }
.footer h4 {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 1rem;
  font-weight: 400;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }

.risk-note {
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-faint);
  max-width: 90ch;
}

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}

/* --------------------------------------------------------------- board nav */
/* Period switcher on the ranking boards. Wraps on narrow screens so every
   period stays visible; nothing hides off the edge. */
.board-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 2rem;
}

.board-nav a {
  flex: 0 0 auto;
  padding: .55rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background-color .15s;
}
.board-nav a span {
  color: var(--text-faint);
  font-size: .78rem;
}
.board-nav a:hover {
  border-color: var(--gold);
  color: var(--text);
}
.board-nav a[aria-current='page'] {
  background: var(--panel-2);
  border-color: var(--gold);
  color: var(--text);
}
.board-nav a[aria-current='page'] span { color: var(--gold); }

/* ------------------------------------------------------------------- blog */
/* Article typography is scoped under .post so the prose cannot collide with
   the ranking pages — notably `.hero`, which is a full-bleed section there but
   arrived from the old blog template as a <figure> class. */
.post__wrap { max-width: 72ch; }
.post__head { padding-block: clamp(3rem, 7vw, 5rem) 1.5rem; }
.post__head h1 { margin-bottom: 1.25rem; }
.post__head h1 em { font-style: italic; color: var(--gold); }
.post__head .lede { color: var(--text-dim); font-size: 1.15rem; }

.post__hero {
  margin: 0 0 3rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.post__hero img { display: block; width: 100%; height: auto; }

.post__body { font-size: 1.05rem; line-height: 1.75; color: var(--text-dim); }
.post__body h2 {
  margin: 3rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  color: var(--text);
  line-height: 1.25;
}
.post__body p { margin: 0 0 1.35rem; }
.post__body strong { color: var(--text); font-weight: 600; }
.post__body em { font-style: italic; }
.post__body ul { margin: 0 0 1.5rem; padding-left: 1.25rem; }
.post__body li { margin-bottom: 0.6rem; }
.post__body li::marker { color: var(--gold); }
.post__body hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.post__body a { color: var(--gold); }

.post__cta {
  margin: 3.5rem 0 0;
  padding: 2rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}
.post__cta h3 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 0.75rem; }
.post__cta p { color: var(--text-dim); margin-bottom: 1.5rem; }

.post__pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 3rem 0 1rem;
}
.post__pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s;
}
.post__pager-link:hover { border-color: var(--gold); }
.post__pager-link:last-child { text-align: right; }
.post__pager-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.post__pager-title { color: var(--text); font-weight: 500; }

/* --- blog index --- */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; counter-reset: none; }
.post-list li { margin: 0; }
.post-list a {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1.25rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.post-list a:hover { border-color: var(--gold); background: var(--panel); }
.post-list img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; }
.post-list h3 { font-family: var(--serif); font-size: 1.25rem; margin: 0.15rem 0 0.4rem; color: var(--text); }
.post-list .dim { font-size: 0.92rem; margin: 0; }

@media (max-width: 640px) {
  .post__pager { grid-template-columns: 1fr; }
  .post__pager-link:last-child { text-align: left; }
  .post-list a { grid-template-columns: 64px 1fr; gap: 0.9rem; }
  .post-list img { width: 64px; height: 64px; }
}

/* ---------------------------------------------------------------- journal */

.journal-goal__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; }
.journal-goal__head h3 { margin: 0; }
.journal-goal__figure { margin: 0; font-size: 1.1rem; }
.journal-goal__bar { height: 10px; margin-top: 1.25rem; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.journal-goal__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-deep), var(--green)); border-radius: inherit; }

.cal { margin-bottom: 3rem; }
.cal__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1.5rem; margin-bottom: 1rem; }
.cal__head h3 { margin: 0; font-family: var(--serif); font-size: 1.6rem; font-weight: 400; }
.cal__head p { margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.cal__grid { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal__grid th { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 0 0.25rem; text-align: left; }
.cal__grid td { vertical-align: top; height: 84px; padding: 0.45rem 0.55rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); position: relative; }
.cal__grid td.cal__pad { border-color: transparent; background: transparent; }
.cal__day.is-weekend { background: transparent; }
.cal__day.is-future { opacity: 0.4; }
.cal__day.is-today { border-color: var(--gold); }
.cal__day.is-win { background: rgb(47 191 113 / var(--a)); border-color: rgb(47 191 113 / 0.45); }
.cal__day.is-loss { background: rgb(229 72 77 / var(--a)); border-color: rgb(229 72 77 / 0.45); }
.cal__link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.cal__link:hover { outline: 1px solid var(--gold); }
.cal__date { display: block; font-family: var(--mono); font-size: 0.72rem; color: var(--text-dim); }
.cal__note { display: inline-block; width: 6px; height: 6px; margin-left: 0.35rem; border-radius: 50%; background: var(--gold); vertical-align: middle; }
.cal__pnl { display: block; margin-top: 0.4rem; font-size: 0.92rem; font-weight: 500; color: var(--text); }
.cal__short { display: none; margin-top: 0.3rem; font-size: 0.72rem; font-weight: 500; color: var(--text); }
.cal__meta { display: block; font-size: 0.66rem; color: var(--text-dim); }
.cal__week { background: transparent !important; border-style: dashed !important; }
.cal__week .num { display: block; font-size: 0.85rem; }

.month-year { margin-top: 1.5rem; }
.month-year__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.month-year__head h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.4rem; }
.month-year__head p { margin: 0; font-size: 0.85rem; }
.month-tiles { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.month-tile { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.55rem 0.65rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); }
.month-tile span { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.month-tile b { font-weight: 500; font-size: 0.9rem; }
.month-tile.pos b { color: var(--green); }
.month-tile.neg b { color: var(--red); }
.month-tile.is-empty { background: transparent; }

/* Key-value and trade tables wrap instead of pushing the page wider than the screen. */
.journal-kv td { white-space: normal; }
.journal-kv td:first-child { font-family: var(--sans); }
.journal-kv td:last-child { white-space: nowrap; }
.journal-trades td { vertical-align: top; }
.show-sm { display: none; }

.journal-chart { margin: 0; }
.journal-chart__plot { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; }
.journal-chart__plot svg { display: block; width: 100%; height: clamp(160px, 28vw, 260px); }
.journal-chart__axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 0.72rem; color: var(--text-faint); text-align: right; }
.journal-chart__dates { display: flex; justify-content: space-between; margin-top: 0.4rem; font-size: 0.72rem; color: var(--text-faint); }
.journal-chart__grid { stroke: var(--rule); stroke-width: 1; }
.journal-chart__line { fill: none; stroke: var(--green); stroke-width: 2; vector-effect: non-scaling-stroke; }
.journal-chart figcaption { margin-top: 0.5rem; }

.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 140px; margin-top: 1rem; }
.hours__col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.hours__bar { display: block; border-radius: 3px 3px 0 0; background: var(--rule); }
.hours__bar.pos { background: var(--green); }
.hours__bar.neg { background: var(--red); }
.hours__label { height: 1rem; font-family: var(--mono); font-size: 0.6rem; color: var(--text-faint); text-align: center; }

/* Phone day views: the MetaTrader 5 iOS History tab, drawn — not a screenshot. */
/* Wrapping grid, never a side-scroller: every phone is fully visible. */
.phones { display: grid; gap: 2rem 1.75rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.phone { margin: 0 auto; width: 100%; max-width: 320px; }
.phone__screen {
  position: relative; min-height: 560px; border-radius: 46px; padding: 0; overflow: hidden;
  background: #fff; color: #000; border: 10px solid #1c1c1e; box-shadow: 0 0 0 1px #3a3a3c, 0 20px 40px rgb(0 0 0 / 0.45);
  font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', var(--sans); display: flex; flex-direction: column;
}
.phone__status { display: flex; justify-content: space-between; align-items: center; padding: 12px 22px 4px; font-size: 13px; font-weight: 600; }
.phone__island { width: 86px; height: 24px; border-radius: 14px; background: #000; }
.phone__home { position: absolute; bottom: 7px; left: 50%; width: 110px; height: 4px; margin-left: -55px; border-radius: 3px; background: #000; }
.phone figcaption { margin-top: 0.75rem; line-height: 1.5; }
.mt5 { flex: 1; display: flex; flex-direction: column; min-height: 0; font-size: 13px; }
.mt5__bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 14px; color: #007aff; font-size: 18px; }
.mt5__bar strong { color: #000; font-size: 16px; }
.mt5__tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 2px 14px 6px; padding: 2px; border-radius: 8px; background: #eeeef0; font-size: 12px; text-align: center; }
.mt5__tabs span { padding: 4px 0; border-radius: 6px; color: #3c3c43; }
.mt5__tabs .is-on { background: #fff; color: #000; font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.15); }
.mt5__range { padding: 2px 14px 4px; color: #8e8e93; font-size: 11px; }
.mt5__sum { margin: 0; padding: 4px 14px 8px; border-bottom: 1px solid #e5e5ea; }
.mt5__sum div { display: flex; justify-content: space-between; line-height: 1.55; }
.mt5__sum dt { color: #000; }
.mt5__sum dd { margin: 0; font-variant-numeric: tabular-nums; }
/* The screen grows with the day: no trade is ever scrolled out of view. */
.mt5__list { list-style: none; margin: 0; padding: 0 0 28px; flex: 1; }
.mt5__row { display: flex; justify-content: space-between; gap: 6px; padding: 7px 14px; border-bottom: 1px solid #efeff4; line-height: 1.35; }
.mt5__row b { font-weight: 600; }
.mt5__buy { color: #1a73e8; }
.mt5__sell { color: #e53935; }
.mt5__prices { color: #8e8e93; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.mt5__right { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.mt5__time { color: #8e8e93; font-size: 10.5px; }
.mt5__gain { color: #1a73e8; font-weight: 600; }
.mt5__loss { color: #e53935; font-weight: 600; }
.journal-goal__ends { display: flex; justify-content: space-between; margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-faint); }

@media (max-width: 640px) {
  .cal__grid { border-spacing: 2px; }
  .cal__grid th { font-size: 0.58rem; letter-spacing: 0.02em; }
  .cal__grid td { height: 52px; padding: 0.3rem 0.25rem; border-radius: 6px; }
  .cal__grid th:last-child, .cal__week { display: none; }
  .cal__pnl, .cal__meta { display: none; }
  .cal__short { display: block; }
  .cal__date { font-size: 0.62rem; }
}

/* Stacked tables (see stackTables in templates.mjs): below tablet width every
   row becomes a card of label/value pairs, so no column is ever cut off. */
@media (max-width: 820px) {
  .ledger--stack thead { display: none; }
  .ledger--stack, .ledger--stack tbody { display: block; width: 100%; }
  .ledger--stack tbody tr { display: grid; grid-template-columns: 1fr; padding: 1rem 0; }
  .ledger--stack tbody tr:hover { background: none; }
  .ledger--stack td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: 0.3rem 0; white-space: normal; text-align: right !important;
  }
  .ledger--stack td::before {
    content: attr(data-label); flex: 0 0 auto; max-width: 45%; text-align: left;
    font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint);
  }
  .ledger--stack td[data-label='']::before { display: none; }
  .ledger--stack td[data-label=''] { justify-content: flex-start; text-align: left !important; }
  /* Ranked rows: the rank sits in a gutter beside the name. */
  .ledger--stack tr:has(td.rank) { grid-template-columns: 2.75rem 1fr; }
  .ledger--stack tr:has(td.rank) td { grid-column: 2; }
  .ledger--stack tr:has(td.rank) td.rank { grid-column: 1; grid-row: 1; align-self: start; width: auto; }
  .ledger--stack tr:has(td.rank) td:nth-child(2) { grid-row: 1; justify-content: flex-start; text-align: left !important; }
  .ledger--stack tr:has(td.rank) td:nth-child(2)::before { display: none; }
  /* Unranked rows (e.g. comparisons): the first cell is the card's title. */
  .ledger--stack tr:not(:has(td.rank)) td:first-child {
    justify-content: flex-start; text-align: left !important; padding-bottom: 0.5rem;
    font-family: var(--sans); font-weight: 600; font-size: 1rem; color: var(--text);
  }
  .ledger--stack tr:not(:has(td.rank)) td:first-child::before { display: none; }
  .ledger--stack td .btn { width: 100%; text-align: center; }
  .ledger--stack .spark { width: 120px; }
}

/* Journal trade tables keep four columns up to tablet width. */
@media (max-width: 900px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .journal-trades td, .journal-trades th { padding-inline: 0.4rem; }
}
@media (max-width: 400px) {
  .journal-trades { font-size: 0.8rem; }
  .journal-trades .tag { padding-inline: 0.35rem; }
}

/* Small laptops and landscape tablets: tighter columns so wide boards fit. */
@media (min-width: 821px) and (max-width: 1200px) {
  .ledger thead th, .ledger td { padding-inline: 0.4rem; }
  .ledger { font-size: 0.86rem; }
  .ledger .spark { width: 72px; }
}

/* Partner FAQ: native <details>, no script. */
.faq { margin-bottom: 0.75rem; padding-block: 1.1rem; }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--mono); color: var(--gold); font-size: 1.2rem; }
.faq[open] summary::after { content: '−'; }
.faq summary h3 { margin: 0; font-size: 1.05rem; }

/* Text comparison tables wrap their cells instead of growing past the page. */
.table-text td { white-space: normal; vertical-align: top; }
.table-text td:first-child { white-space: nowrap; color: var(--text-dim); }
