/* coe.css: the Centre of Excellence design system (docs/SPEC.md section 10).
 *
 * The reference is Apple Intelligence: a black ground, one clean sans in tight, confident sizes,
 * soft floating cards with large corners, frosted glass for anything that sits over the page, and
 * one piece of colour: a slow, soft spectrum of light (amber, pink, violet, blue) that marks what
 * matters most on a screen. Everything else stays quiet, so the light means something.
 *
 * There are no inline styles anywhere (the CSP forbids them), and the spectrum is defined once,
 * here, so that the ring, the ambient light and the chart agree.
 *
 * Classes
 *   layout     .wrap .main .row .row--between .grid--2 .sheet .solo (one centred form) .bento
 *   masthead   .masthead .brand .wordmark .nav .header-side .header-side__who .skip
 *   footer     .site-footer .site-footer__rule .site-footer__small .site-footer__links .site-footer__legal
 *   cards      .part (a card) .part--hero .part--center .glow (the spectrum ring) .part__side
 *              .part__head .part__sub .part__note .part__main .part__main--split .part__chart
 *              .part__foot .part__link .fold (a card that opens)
 *   documents  .prose (short text) .prose--long (legal pages) .doc-head .doc-toc .doc-no .doc-table
 *              .warning
 *   type       .title .title--large .lede .small .muted .faint .nowrap .num (tabular figures)
 *              .page-head .page-head__meta .page-foot
 *   figures    .lead-figure .lead-figure__note .figure .figure--sm .gain .loss .flat
 *   ledgers    .ledger (label, note, figure) .ledger__note .ledger__total .dl (definition rows)
 *   tables     .table .table--stack (stacked rows on phones; give cells data-label) .table--trades
 *              .table__empty .table__total .cell-text (a sentence in a stacked row)
 *   status     .state .state--copying .state--paused .state--warn .state--pending .state--failed .state--muted
 *   actions    .button .button--primary .button--quiet .button--danger .button--small .button--block
 *              .link-button .actions
 *   forms      .form .field .field__label .field__help .field__error .check .form-errors
 *   notices    .notices .notice .notice--info .notice--warn .notice--error .notice--ok .notice--quiet
 *   misc       .empty .pager .switch (segmented control; the current one has aria-current)
 *              .visually-hidden
 *   calendar   .cal .cal__week (role=row) .cal__head .cal__wide .cal__narrow .cal__day .cal__day--weekend
 *              .cal__day--out .cal__day--today .cal__day--gain .cal__day--loss .cal__date .cal__pnl
 *              .cal__full .cal__compact .cal__trades .cal-nav
 *   chart      .chart .chart__svg .chart__grid .chart__axis .chart__area .chart__line .chart__base
 *              .chart__bar .chart__hover .chart__dot .chart__end .chart__halo .chart__tip .chart__fallback
 *   insights   .brief (the month in words) .tiles .tile .ring .duel .bar .spark .legend
 *   landing    .opening .opening__text .opening__seal .opening__links
 *   print      .no-print, and the @media print block at the end
 *
 * Legibility rules (audit D8 and D9, checked by coe/tests/test_design.py so they cannot drift):
 *   - every colour that carries text is at least 4.5:1 on --ground and --card, and the tinted panels
 *     carry only colours that are 4.5:1 on them (WCAG AA); form field borders are at least 3:1
 *     (WCAG 1.4.11). --hair is decoration and stays quiet.
 *   - no text below 0.75rem (12px) outside print.
 *   - all motion stops under prefers-reduced-motion.
 */

/* On Apple hardware the first two names are San Francisco itself. Everywhere else the file below
   stands in, served from this site. */
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-latin-wght.c501f578bf3f.woff2") format("woff2");
}

/* the angle the spectrum ring turns through, registered so that it can be animated */
@property --spin {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  /* native controls (scrollbars, checkboxes, the select popup, autofill) draw dark, like the page */
  color-scheme: dark;

  --ground: #000000;
  --card: #161618;
  --card-2: #232326;
  --field: #0e0e10;
  --ink: #f5f5f7;
  --muted: #aeaeb2;
  /* the quietest text: dates, axes, "(member sees this)". Well under --muted, so the order holds */
  --faint: #8e8e93;
  --rule: #48484a;
  /* row lines and grid lines: decoration, never text */
  --hair: #2c2c2e;
  /* input, select and textarea borders */
  --field-rule: #6e6e73;
  /* links and focus: Apple's blue on black */
  --signal: #2997ff;
  /* gains, cautions and losses, in Apple's dark-mode system colours, and the tints they sit on */
  --gain: #30d158;
  --loss: #ff6961;
  --warn: #ffb340;
  --gain-dim: #0f2a18;
  --loss-dim: #33161a;
  --warn-dim: #332409;
  /* the spectrum */
  --s1: #ffb340;
  --s2: #ff5e87;
  --s3: #bf5af2;
  --s4: #4c9dff;

  --sans: -apple-system, BlinkMacSystemFont, "Hanken Grotesk", "Segoe UI", Helvetica, Arial, sans-serif;

  --gutter: clamp(16px, 3vw, 28px);
  --max: 1120px;
  --r: 24px;
  --r-small: 14px;
  --gap: 16px;
  --glass: saturate(180%) blur(24px);
}

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

html { -webkit-text-size-adjust: 100%; background: var(--ground); }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.47;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: lining-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* the ambient light, on the landing page only: the spectrum, blurred, resting above the top of the
   page and moving slowly. On inner pages it read as a muddy brown band behind the data. */
body.home::before {
  content: "";
  position: fixed;
  z-index: -1;
  left: 50%;
  top: -34vh;
  width: min(1500px, 170vw);
  height: 72vh;
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side at 22% 60%, rgba(255, 179, 64, 0.14), transparent),
    radial-gradient(closest-side at 42% 44%, rgba(255, 94, 135, 0.3), transparent),
    radial-gradient(closest-side at 62% 58%, rgba(191, 90, 242, 0.36), transparent),
    radial-gradient(closest-side at 82% 44%, rgba(76, 157, 255, 0.34), transparent);
  filter: blur(72px);
  pointer-events: none;
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translateX(-52%) scale(1); }
  to { transform: translateX(-48%) scale(1.08); }
}

a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--sans); font-weight: 600; line-height: 1.12; letter-spacing: -0.022em; margin: 0; }
p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.875em; }

.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 8px; background: var(--card); padding: 6px 10px; border-radius: 8px; z-index: 40; }

/* ------------------------------------------------------------------ layout */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
/* a stacking context of its own, so that the glow ring can sit behind a card's opaque fill */
.main { position: relative; z-index: 0; flex: 1; padding-top: 30px; padding-bottom: 64px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.row--between { justify-content: space-between; }
.grid--2 { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.sheet { max-width: 40rem; margin: 6vh auto 0; }
.sheet > * + * { margin-top: 14px; }
.bento { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); margin-top: var(--gap); }
.bento > .part { margin-top: 0; display: flex; flex-direction: column; }
.bento > .part > .part__main { flex: 1; display: flex; flex-direction: column; }
.bento > .part:only-child { grid-column: 1 / -1; }
.bento .part__main > .part__foot:last-child { margin-top: auto; padding-top: 14px; }
.bento .dl { grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); }
@media (min-width: 900px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .bento--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento--wide-first { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .prose.prose--columns { columns: 2; column-gap: 40px; max-width: none; }
  .prose--columns p { break-inside: avoid; }
}
/* one form on its own, in the middle of the screen */
.solo { max-width: 27.5rem; margin: 5vh auto 0; }
.solo > .title { text-align: center; font-size: 2.25rem; }
.solo > .lede { text-align: center; }
.solo .part__side { display: block; text-align: center; }
.solo .part__side > * + * { margin-top: 6px; }
.solo .button--primary { display: block; width: 100%; }
.section-gap { margin-top: 28px; }
.section-gap--small { margin-top: 12px; }
.section-gap-below { margin-bottom: 18px; }

/* ------------------------------------------------------------------ masthead */
/* The glass is on a pseudo-element, not the bar itself: backdrop-filter would make the bar the
   containing block of the phone's fixed nav, which lives inside it. */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px 22px;
  min-height: 52px;
  padding: 6px max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
}
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.wordmark { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; }
.nav { display: flex; gap: 2px; margin-left: 6px; }
.nav a { padding: 6px 13px; border-radius: 999px; color: var(--muted); font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); background: rgba(255, 255, 255, 0.14); }
.header-side { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 0.875rem; white-space: nowrap; }
.header-side form { margin: 0; }
.header-side a:not(.button) { color: var(--ink); }
.header-side__who { color: var(--muted); }

/* ------------------------------------------------------------------ footer */
.site-footer { padding-bottom: 28px; color: var(--faint); font-size: 0.75rem; line-height: 1.5; }
.site-footer a { color: var(--muted); }
.site-footer__rule { border-top: 1px solid var(--hair); padding-top: 14px; display: grid; gap: 10px 32px; grid-template-columns: minmax(0, 1fr); }
.site-footer__small p { margin: 0 0 0.5em; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.site-footer__small { max-width: 110ch; }

/* ------------------------------------------------------------------ cards */
.part {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r);
  padding: 26px 30px;
  margin-top: var(--gap);
}
.page-head + .part, h1 + .part { margin-top: 20px; }
.part__side { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 14px; min-width: 0; }
.part__head { font-size: 1.1875rem; }
.part__sub { font-size: 1rem; margin: 1.4em 0 0.5em; }
.part__note { flex-basis: 100%; font-size: 0.875rem; line-height: 1.45; color: var(--muted); }
.part__note p { margin: 0 0 0.5em; }
.part__main { min-width: 0; }
.part__chart { margin-top: 22px; }
.part__foot { margin-top: 12px; }
.part__side .switch, .part__side .cal-nav, .part__side .part__link { margin-left: auto; }
@media (min-width: 860px) {
  .part__main--split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 23rem); column-gap: 40px; align-items: end; }
}
.part--hero { padding: 30px 32px; }
.part--hero .part__side { margin-bottom: 8px; }
.part--hero .ledger tr { border: 0; }
.part--hero .ledger th, .part--hero .ledger td { padding: 3px 0; }
.part--hero .ledger th { color: var(--muted); width: auto; }
.part--hero .part__head { font-size: 1rem; font-weight: 500; color: var(--muted); }
.part--center { text-align: center; }
.part--center .part__side { justify-content: center; }

/* The ring of light. Both layers sit behind the card's opaque fill, which is why the card itself
   makes no stacking context: only the edge of the ring shows, with its bloom spilling outward. */
.glow { border-color: transparent; }
.glow::before, .glow::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from var(--spin), var(--s1), var(--s2), var(--s3), var(--s4), var(--s1));
  animation: spin 14s linear infinite;
}
.glow::before { inset: -1.5px; }
.glow::after { inset: -2px; filter: blur(24px); opacity: 0.42; }
@keyframes spin { to { --spin: 360deg; } }

/* ------------------------------------------------------------------ type */
.title { font-family: var(--sans); font-size: clamp(2.125rem, 4.4vw, 3rem); font-weight: 600; line-height: 1.08; letter-spacing: -0.03em; margin-bottom: 8px; text-wrap: balance; }
.title--large {
  font-size: clamp(2.625rem, 7.2vw, 5.25rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  padding-bottom: 0.08em;
  background: linear-gradient(100deg, #ffffff 0%, #ffffff 42%, #ffd28a 58%, #ff9db5 72%, #cfa8ff 86%, #8fbcff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title--large .gold {
  background: linear-gradient(100deg, #ffe0a3 0%, #ffb340 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { font-size: 1.1875rem; line-height: 1.42; color: var(--muted); max-width: 60ch; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
/* read by screen readers, not shown: "View" links name their statement, the calendar's S and S
   are Saturday and Sunday (audit D13) */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.num, .figure, .lead-figure, .table td.num, .table th.num { font-variant-numeric: tabular-nums lining-nums; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 32px; margin-bottom: 16px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 22rem; }
.page-head .title { margin-bottom: 0; }
.page-head__meta { font-size: 0.875rem; color: var(--muted); margin: 6px 0 0; }
.page-foot { font-size: 0.75rem; color: var(--faint); margin: 12px 4px 0; }

/* ------------------------------------------------------------------ figures */
/* The one number a page is about, large and quietly lit from above */
.lead-figure {
  font-size: clamp(3rem, 8.2vw, 5.5rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
  margin: 0;
  white-space: nowrap;
  background: linear-gradient(180deg, #ffffff 30%, #b6b6be 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead-figure__note { color: var(--muted); margin: 6px 0 0; }
.figure { font-size: 2.5rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.035em; }
.figure--sm { font-size: 1.375rem; line-height: 1.25; letter-spacing: -0.022em; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.flat { color: var(--muted); }
/* a signed amount inside a sentence ("from copied trades +£225.69") broke after the sign on a
   phone; spans only, since dd and td carry whole sentences in these colours on the desk. Not
   .small either: the desk's member table gives each problem a sentence as a small red span, and
   unbroken it pushed the page 190px wider than a phone (browser pass, 2026-10-30) */
span:is(.gain, .loss, .flat):not(.small) { white-space: nowrap; }

/* ------------------------------------------------------------------ ledgers */
/* Label, a note, the figure on the right. On phones and beside a lead figure the note drops under
   the label and the figure stays on the right. */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.ledger tr { border-top: 1px solid var(--hair); }
.ledger tr:first-child { border-top: 0; }
.ledger th, .ledger td { padding: 9px 0; text-align: left; font-weight: 400; vertical-align: baseline; }
.ledger th { width: 34%; }
.bento .ledger th { width: auto; }
.ledger .ledger__note { color: var(--muted); font-size: 0.875rem; padding-left: 16px; }
.ledger .num { text-align: right; white-space: nowrap; padding-left: 16px; font-weight: 500; }
.ledger__total th, .ledger__total td { font-weight: 600; }
.ledger .ledger__total { border-top: 1px solid var(--rule); }
@media (min-width: 860px) {
  .part__main--split .ledger, .part__main--split .ledger tbody { display: block; }
  .part__main--split .ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 7px 0; }
  .part__main--split .ledger th, .part__main--split .ledger td { padding: 0; width: auto; }
  .part__main--split .ledger .num { grid-column: 2; grid-row: 1; padding-left: 0; }
  .part__main--split .ledger .ledger__note { grid-column: 1 / -1; grid-row: 2; padding-left: 0; }
}

.dl { display: grid; grid-template-columns: minmax(120px, 13rem) minmax(0, 1fr); margin: 0; }
.dl dt, .dl dd { padding: 9px 0; border-top: 1px solid var(--hair); }
.dl dt { padding-right: 16px; color: var(--muted); }
.dl dd { margin: 0; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.dl > :nth-child(-n+2) { border-top: 0; }

/* ------------------------------------------------------------------ tables */
/* tabular figures in every cell, not only .num: times and logins line up down a column too (D13) */
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums lining-nums; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.8125rem; padding: 0 16px 8px 0; border-bottom: 1px solid var(--hair); white-space: nowrap; vertical-align: bottom; }
.table td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; white-space: nowrap; }
@media (min-width: 641px) {
  .table td.num + td:not(.num), .table th.num + th:not(.num) { padding-left: 28px; }
}
.table--trades th:last-child, .table--trades td:last-child { text-align: right; }
.table th a { color: inherit; }
.table td a { color: var(--ink); font-weight: 500; }
.table__empty { color: var(--faint); padding: 10px 0; }
.table .table__total td { border-top: 1px solid var(--rule); font-weight: 600; font-size: 1.0625rem; }
.table-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 10px 0; border-bottom: 1px solid var(--hair); }
  .table--stack tr:first-child { padding-top: 0; }
  .table--stack tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .table--stack td { border: 0; padding: 1px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; text-align: right; }
  .table--stack td::before { content: attr(data-label); color: var(--muted); font-size: 0.8125rem; text-align: left; }
  .table--stack td.num { text-align: right; }
  /* a sentence, or a form, in a stacked row: label above it, ranged left */
  .table--stack td.cell-text, .doc-table:not(.doc-table--figures).table--stack td { display: block; text-align: left; padding: 2px 0; }
  .table--stack td.cell-text::before, .doc-table:not(.doc-table--figures).table--stack td::before { display: block; }
  /* a trade is three lines: when and the result, what and its source, the size and prices */
  .table--trades tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
  .table--trades td { display: block; width: auto; text-align: left; }
  .table--trades td[data-label="Closed"], .table--trades td[data-label="Side"] { grid-column: 1 / 3; }
  .table--trades td[data-label="Closed"]::before, .table--trades td[data-label="Side"]::before,
  .table--trades td[data-label="Result"]::before, .table--trades td[data-label="Source"]::before { content: none; }
  .table--trades td[data-label="Result"] { grid-column: 3; grid-row: 1; text-align: right; font-weight: 600; }
  .table--trades td[data-label="Source"] { grid-column: 3; grid-row: 2; text-align: right; color: var(--muted); }
  .table--trades td[data-label="Lots"], .table--trades td[data-label="Open"], .table--trades td[data-label="Close"] { color: var(--muted); font-size: 0.8125rem; text-align: left; }
  .table--trades td[data-label="Lots"]::before, .table--trades td[data-label="Open"]::before, .table--trades td[data-label="Close"]::before { content: attr(data-label) " "; font-size: 0.75rem; color: var(--faint); }
  /* the rest are list rows too: the name and the key figure on one line, the detail under them */
  .table--stack td.cell-text[data-label=""] { display: none; }
  .table--list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 12px; }
  .table--list td, .table--list td.num { display: block; width: auto; text-align: left; padding: 0; }
  .table--list td:first-child { font-weight: 600; }
  .table--list td:first-child::before, .table--list td[data-label=""]::before, .table--list td[data-label="Result"]::before,
  .table--list td[data-label="Return"]::before, .table--list td[data-label="Status"]::before { content: none; }
  .table--list td[data-label=""], .table--list td[data-label="Result"] { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; }
  .table--list td[data-label="Return"], .table--list td[data-label="COE share"] { grid-column: 2; grid-row: 2; text-align: right; }
  .table--list td[data-label="Status"] { grid-column: 1 / -1; }
  .table--list td[data-label="Opening equity"], .table--list td[data-label="Closed trades"], .table--list td[data-label="Copied trades"],
  .table--list td[data-label="COE share"] { color: var(--muted); font-size: 0.8125rem; }
  .table--list td[data-label="Opening equity"]::before, .table--list td[data-label="Closed trades"]::before, .table--list td[data-label="Copied trades"]::before,
  .table--list td[data-label="COE share"]::before { content: attr(data-label) " "; font-size: 0.75rem; color: var(--faint); }
  .table--list td[data-label=""] a { display: inline-block; padding: 6px 0 6px 12px; margin: -6px 0; }
  /* a history is a list of sentences: when, then what, with no labels */
  .table--log td, .table--log td.cell-text { display: block; width: auto; text-align: left; padding: 0; }
  .table--log td::before, .table--log td.cell-text::before { content: none; }
  .table--log td[data-label="When"], .table--log td[data-label="Event"], .table--log td[data-label="By"] { color: var(--muted); font-size: 0.8125rem; }
  .ledger, .ledger tbody { display: block; }
  .ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 8px 0; }
  .ledger th, .ledger td { padding: 0; width: auto; }
  .ledger .num { grid-column: 2; grid-row: 1; padding-left: 0; }
  .ledger .ledger__note { grid-column: 1 / -1; grid-row: 2; padding-left: 0; }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { padding-bottom: 0; }
  .dl dd { padding-top: 0; border-top: 0; }
  .dl > :nth-child(2) { border-top: 0; }
  .dl > dt:not(:first-child) { border-top: 1px solid var(--hair); }
}

/* ------------------------------------------------------------------ status */
.state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--card-2);
}
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.state--copying { color: var(--gain); background: var(--gain-dim); }
.state--paused, .state--warn { color: var(--warn); background: var(--warn-dim); }
.state--pending { color: var(--muted); }
.state--failed { color: var(--loss); background: var(--loss-dim); }
.state--muted { color: var(--muted); }
/* the account state, shown here only on phones, where the header drops it (audit D11) */
.page-head__state { display: none; }

/* ------------------------------------------------------------------ buttons */
.button {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.011em;
  line-height: 1.2;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.button:hover { background: #333337; text-decoration: none; }
.button:active { transform: scale(0.98); }
.button--primary { background: var(--ink); color: var(--ground); font-weight: 600; }
.button--primary:hover { background: #ffffff; }
.button--danger { color: var(--loss); }
.button--small { font-size: 0.8125rem; padding: 6px 13px; }
.button--block { display: block; width: 100%; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }
.button[hidden] { display: none; }

.link-button { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; color: var(--ink); cursor: pointer; }
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.actions form { margin: 0; }

/* ------------------------------------------------------------------ forms */
.form { max-width: 30rem; }
.form--wide { max-width: 38rem; }
.field { margin-bottom: 14px; }
.field__label, .field > label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--field-rule);
  border-radius: 12px;
  padding: 10px 13px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 4px rgba(41, 151, 255, 0.25); outline: none; }
/* Browser autofill painted the sign-in fields pale blue. The text and caret are set back to ours,
   and the browser's own fill is held off by a transition too slow ever to finish. Firefox tints
   autofilled fields with a filter instead; that is switched off. */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  transition: background-color 9999s ease-out 0s;
  filter: none;
}
input::placeholder { color: var(--faint); }
.field__help { margin-top: 5px; font-size: 0.8125rem; line-height: 1.45; color: var(--muted); }
.field__help ul { margin: 2px 0 0; padding-left: 1.1em; }
.field__error, .errorlist { margin: 4px 0 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--loss); }
.field--invalid input, .field--invalid select { border-color: var(--loss); }
.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--signal); flex: none; }

/* ------------------------------------------------------------------ notices */
/* A neutral row with a coloured dot, as a notification sits on iOS: tinted panels sank into the
   page and read as a stock alert component. */
.notice { position: relative; background: var(--card); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--r-small); padding: 11px 16px 11px 34px; margin: 0 0 8px; }
.notice::before { content: ""; position: absolute; left: 15px; top: 19px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.notice--ok::before { background: var(--gain); }
.notice--warn::before { background: var(--warn); }
.notice--error::before { background: var(--loss); }
/* a request, not a warning: asking a member to confirm their email (audit D6) */
.notice--quiet { color: var(--muted); font-size: 0.875rem; }
.notice--quiet::before { background: var(--muted); }
.notice strong { font-weight: 600; }
.notice a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.notice p { margin-bottom: 0.4em; }
.notice p:last-child { margin-bottom: 0; }
.notice summary { cursor: pointer; }
.notice[open] summary { margin-bottom: 0.4em; }
.notices { margin-top: var(--gap); }
.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.messages .notice { margin-bottom: 8px; }
/* the risk warning: reading size, in ink, not a grey line nobody reads (audit D2) */
.warning { line-height: 1.5; max-width: 70ch; }

/* ------------------------------------------------------------------ misc */
.empty { color: var(--muted); margin: 0; padding: 4px 0; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 14px; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums lining-nums; }
/* the segmented control */
.switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); font-size: 0.8125rem; font-weight: 500; }
.switch a { padding: 3px 12px; border-radius: 8px; color: var(--muted); }
.switch a:hover { color: var(--ink); text-decoration: none; }
.switch a[aria-current="page"] { background: rgba(255, 255, 255, 0.18); color: var(--ink); }

/* ------------------------------------------------------------------ month P/L calendar */
.cal-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; font-size: 0.875rem; }
.cal-nav a[aria-label="Previous month"]::before { content: "\2039\00a0"; }
.cal-nav a[aria-label="Next month"]::after { content: "\00a0\203a"; }
.cal {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, 0.42fr));
  gap: 4px;
  font-variant-numeric: tabular-nums lining-nums;
}
/* a week is an ARIA row (role=row) but not a box: its cells stay items of the .cal grid */
.cal__week { display: contents; }
.cal__head { color: var(--muted); font-size: 0.75rem; font-weight: 500; padding: 0 8px 4px; }
.cal__narrow { display: none; }
.cal__day { min-height: 68px; padding: 6px 8px 7px; display: flex; flex-direction: column; min-width: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.cal__date { font-size: 0.75rem; color: var(--faint); }
/* one unbroken figure: overflow-wrap:anywhere split "-£1,234.56" across lines in a phone column */
.cal__pnl { font-size: 0.875rem; font-weight: 500; line-height: 1.25; margin-top: auto; text-align: right; overflow-wrap: normal; white-space: nowrap; }
.cal__compact { display: none; }
.cal__trades { font-size: 0.75rem; color: var(--muted); text-align: right; }
.cal__day--gain { background: var(--gain-dim); }
.cal__day--loss { background: var(--loss-dim); }
.cal__day--gain .cal__date, .cal__day--loss .cal__date { color: var(--muted); }
.cal__day--weekend { background: transparent; }
.cal__day--out { background: transparent; }
.cal__day--out .cal__date { visibility: hidden; }
.cal__day--today { box-shadow: inset 0 0 0 1px var(--rule); }
.cal__day--today .cal__date { color: var(--ink); font-weight: 600; }
@media (max-width: 640px) {
  .cal { gap: 2px; }
  .cal__day { min-height: 46px; padding: 3px 4px 4px; border-radius: 7px; }
  .cal__pnl { font-size: 0.75rem; }
  /* a weekday cell is about 43px of text at 375px, and "-£1,234.56" needs 46: the compact figure
     ("-£1.2k") always fits. Above 640px the full figure fits. */
  .cal__full { display: none; }
  .cal__compact { display: inline; }
  .cal__head { padding: 0 3px 3px; }
  /* "SATSUN" ran together in the two narrow columns: S and S, the names kept for screen readers */
  .cal__wide {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .cal__narrow { display: inline; }
  .cal__trades { display: none; }
}

/* ------------------------------------------------------------------ chart */
.chart { position: relative; }
.chart__svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__grid { stroke: var(--hair); stroke-width: 1; shape-rendering: crispEdges; }
.chart__base { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.chart__axis { fill: var(--faint); font-family: var(--sans); font-size: 12px; font-variant-numeric: tabular-nums lining-nums; }
.chart__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__end { fill: var(--ink); }
.chart__halo { fill: var(--ink); opacity: 0.16; }
.chart__hover { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; }
.chart__dot { fill: var(--ground); stroke: var(--ink); stroke-width: 2; }
.chart__tip {
  position: absolute;
  top: 0;
  pointer-events: none;
  background: rgba(44, 44, 46, 0.78);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 11px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}
.chart__bar--gain { fill: var(--gain); fill-opacity: 0.8; }
.chart__bar--loss { fill: var(--loss); fill-opacity: 0.8; }
.chart__line--quiet { stroke: var(--faint); stroke-width: 1.5; }
.chart__tip-line { display: block; }
.chart__tip[hidden] { display: none; }
.chart__tip strong { display: block; font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.chart__fallback { margin-top: 10px; }
.js .chart__fallback { display: none; }
.chart svg:focus { outline: none; }

/* a card that opens: the working behind a page, out of the way until someone wants it */
.fold summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "\203a"; font-size: 1.375rem; line-height: 1; color: var(--muted); transform: rotate(90deg); transition: transform 0.2s ease; }
.fold[open] summary::after { transform: rotate(-90deg); }
.fold .part__main { margin-top: 14px; }

/* ------------------------------------------------------------------ insights */
/* The month in words, lit by a small piece of the spectrum, as a summary is on an iPhone */
.brief { margin: 26px 4px 24px; }
.brief__text { font-size: 1.1875rem; line-height: 1.42; letter-spacing: -0.016em; color: var(--muted); margin: 0; max-width: 72ch; }
.brief__text strong { font-weight: 600; color: var(--ink); }

.tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { display: flex; flex-direction: column; min-width: 0; background: var(--card); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--r); padding: 18px 20px; }
.tile__head { font-size: 0.875rem; font-weight: 500; color: var(--muted); margin-bottom: 12px; }
.tile__note { font-size: 0.8125rem; line-height: 1.4; color: var(--faint); margin: auto 0 0; padding-top: 12px; }
.tile__figure { font-size: 2rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums lining-nums; margin: 0 0 10px; }
@media (min-width: 900px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.ring { position: relative; width: 104px; height: 104px; margin: 0 auto; }
.ring__svg { display: block; width: 100%; height: 100%; }
.ring__track { fill: none; stroke: var(--card-2); stroke-width: 11; }
.ring__value { fill: none; stroke-width: 11; stroke-linecap: round; }
.ring__figure { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums lining-nums; }

.duel__row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; margin: 0 0 4px; font-variant-numeric: tabular-nums lining-nums; }
.duel__row span:last-child { font-weight: 600; }
.bar { display: block; margin: 0 0 14px; }
.bar__track { fill: var(--card-2); }
.bar__gain { fill: var(--gain); }
.bar__loss { fill: var(--loss); }
.bar__spectrum { fill: var(--s3); }
.bar--split { margin: 12px 0 0; }

.spark { display: block; width: 100%; height: 44px; }
.spark__area { fill: var(--loss-dim); stroke: var(--loss); stroke-width: 1.5; stroke-linejoin: round; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; flex-basis: 100%; font-size: 0.875rem; font-weight: 500; margin: 0; }
.legend__you, .legend__master { display: inline-flex; align-items: center; gap: 6px; }
.legend__you::before, .legend__master::before { content: ""; width: 14px; height: 3px; border-radius: 2px; }
.legend__you::before { background: conic-gradient(var(--s1), var(--s2), var(--s3), var(--s4), var(--s1)); }
.legend__master::before { background: var(--faint); }

/* ------------------------------------------------------------------ landing */
.opening { text-align: center; max-width: 54rem; margin: 0 auto; padding: 5vh 0 6vh; }
.opening > * { animation: rise 1s cubic-bezier(0.16, 1, 0.3, 1) both; }
.opening > :nth-child(2) { animation-delay: 0.12s; }
@keyframes rise {
  from { transform: translateY(14px); }
  to { transform: none; }
}
.opening__seal { display: block; width: 104px; height: 104px; margin: 0 auto 22px; }
.opening__text .title { margin-bottom: 18px; }
.opening__text .lede { margin: 0 auto; }
.opening__links { margin-top: 26px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.opening__invite { margin-top: 12px; font-size: 0.875rem; color: var(--faint); }

/* on a phone the nav is a floating bar of glass along the bottom, where a thumb is */
@media (max-width: 760px) {
  body:has(.nav) { padding-bottom: 84px; }
  .nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
    margin: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding: 4px;
    border-radius: 22px;
    background: rgba(44, 44, 46, 0.72);
    -webkit-backdrop-filter: var(--glass);
    backdrop-filter: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  .nav a { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 4px 2px; border-radius: 18px; font-size: 0.75rem; line-height: 1.15; white-space: normal; }
  .header-side .link-button, .header-side a:not(.button) { padding: 12px 0; }
  .cal-nav a { display: inline-block; padding: 8px 0; margin: -8px 0; }
  /* brand and Sign out on one row: the overview's page head carries the account state instead */
  .header-side .state, .header-side__who { display: none; }
  .page-head__state { display: inline-flex; }
}
@media (max-width: 640px) {
  :root { --r: 20px; }
  .part { padding: 18px; }
  .brief { margin: 20px 2px; }
  .brief__text { font-size: 1.0625rem; }
  .tile { padding: 16px; }
  .ring { width: 96px; height: 96px; }
  .part--hero { padding: 22px 20px; }
  .main { padding-top: 22px; }
  .form, .form--wide { max-width: none; }
  .opening { padding-top: 3vh; }
  .opening__seal { width: 84px; height: 84px; margin-bottom: 16px; }
}

/* ------------------------------------------------------------------ prose */
/* .prose: short explanatory text. .prose--long: a document read from top to bottom (the legal
   pages): the contents stay beside the text, which is about 70 characters wide, with numbered
   section headings that can be linked to (/terms/#fees). */
.prose { max-width: 66ch; }
.prose--long p, .prose--long li, .prose--long td { line-height: 1.55; }
.prose--long p { margin: 0 0 0.8em; }
.prose--long section { scroll-margin-top: 72px; }
.prose--long h2 { font-size: 1.3125rem; margin: 1.7em 0 0.45em; }
.prose--long ul, .prose--long ol { margin: 0 0 0.9em; padding-left: 1.3em; }
.prose--long li + li { margin-top: 0.35em; }
.prose--long strong { font-weight: 600; }
.doc-head { margin-bottom: 20px; }
.doc-head .title { margin: 0 0 4px; }
.doc-no { color: var(--faint); margin-right: 0.3em; font-variant-numeric: lining-nums; }
.doc-toc { font-size: 0.875rem; line-height: 1.35; margin: 0 0 18px; color: var(--muted); }
.doc-toc ol { margin: 0; padding-left: 1.6em; }
.doc-toc li { margin: 0 0 6px; }
.doc-toc li + li { margin-top: 0; }
.doc-toc a { color: var(--muted); }
.doc-toc a:hover { color: var(--ink); }
.doc-table { margin: 4px 0 1em; }
.prose--long .doc-table td { line-height: 1.4; }
.doc-table--figures td:first-child { white-space: nowrap; }
@media (min-width: 900px) {
  .prose--long { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); column-gap: 2.5rem; max-width: none; }
  .prose--long > * { grid-column: 2; max-width: 44rem; }
  .prose--long > .doc-head { grid-column: 1 / -1; max-width: none; }
  .prose--long > .doc-toc { grid-column: 1; grid-row: 2 / span 30; align-self: start; position: sticky; top: 72px; }
}

/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ print (statements) */
@media print {
  :root {
    color-scheme: light;
    --ground: #fff; --card: #fff; --card-2: #fff; --field: #fff; --ink: #111; --muted: #444; --faint: #666;
    --rule: #111; --hair: #bbb; --signal: #111; --gain: #111; --loss: #8a1f17; --warn: #111;
    --gain-dim: #fff; --loss-dim: #fff; --warn-dim: #fff;
  }
  /* statement-sized type: at 12pt a due statement with payee details ran onto a second A4 page */
  html { font-size: 12.5px; background: #fff; }
  body { font-size: 9.5pt; letter-spacing: 0; padding-bottom: 0; }
  body::before, .glow::before, .glow::after, .masthead::before { display: none !important; }
  .nav, .header-side, .no-print, .skip { display: none !important; }
  .masthead { position: static; min-height: 0; padding: 0 0 4px; border-bottom: 1px solid #111; }
  /* one seal per printed page (a statement carries its own), and of the footer only the line
     that says who issued it (audit D4) */
  .brand img, .site-footer__links, .site-footer__small > p:not(.site-footer__legal) { display: none !important; }
  .site-footer { padding: 8px 0 0; font-size: 9pt; color: #444; }
  .site-footer__rule { display: block; padding-top: 4px; }
  a { color: inherit; text-decoration: none; }
  .wrap { max-width: none; padding-left: 0; padding-right: 0; }
  .main { padding-top: 10px; padding-bottom: 10px; }
  .title, .lead-figure { background: none; color: #111; }
  .table .table__total td { border-bottom: 3px double #111; font-size: inherit; }
  @page { margin: 14mm 14mm 12mm; }
}
