/* TradeMetrics · institutional analytics workspace */
:root {
  color-scheme: light;
  --site-primary: #14364d;
  --site-on-primary: #fff;
  --site-secondary: #e8efef;
  --site-on-secondary: #163847;
  --site-background: #f3f5f7;
  --site-on-background: #1e3042;
  --site-font-body: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --site-font-heading: var(--site-font-body);
  --ink: #172c40;
  --muted: #5d6e7f;
  --quiet: #748394;
  --line: #dde4ea;
  --navy: #10283c;
  --navy-deep: #0c2031;
  --gold: #c4a36a;
  --teal: #0c766a;
  --loss: #b34a4a;
}

html { scroll-behavior: smooth; }
body { font-size: 13px; -webkit-font-smoothing: antialiased; }
details { margin-bottom: 18px; }
summary { padding: 14px 18px; border: 1px solid var(--line); background: #fff; color: #36536b; cursor: pointer; font-size: 11px; font-weight: 600; border-radius: 4px; }
details[open] summary { border-radius: 4px 4px 0 0; border-bottom: 0; }
details[open] #mappingPanel { border-radius: 0 0 4px 4px; }
.control-grid label.coverage-confirm { flex-direction: row; align-items: center; line-height: 1.7; }
.coverage-confirm input { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--navy); }
.gridline { stroke: #e2e8ed; stroke-width: 1; }
.table:not(.wide-table):not(#ledgerTable) td { white-space: normal; overflow-wrap: anywhere; }
button, input, select { font-family: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #b89559;
  outline-offset: 3px;
}
.root { background: var(--site-background); color: var(--ink); }

/* A restrained, permanent brand frame. */
.top {
  height: 78px;
  padding: 0 32px;
  background: var(--navy-deep);
  color: #f9fbfd;
  border: 0;
  border-bottom: 1px solid #294052;
}
.brand { gap: 13px; font-size: 21px; font-weight: 650; letter-spacing: -.035em; }
.mark {
  width: 37px;
  height: 37px;
  border: 1px solid #9c835d;
  border-radius: 2px;
  background: transparent;
  color: #e4cca6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
}
.top small { margin-top: 4px; color: #a6b6c3; font-size: 8px; letter-spacing: .22em; font-weight: 500; }
.top > div:last-child:not(.brand) { color: #b8c6d1 !important; font-size: 10px !important; letter-spacing: .1em; }
.top > div:last-child b {
  margin-left: 10px;
  width: 32px !important;
  height: 32px !important;
  border-radius: 3px !important;
  background: #233f53 !important;
  border: 1px solid #4c6070;
  color: #e5d0aa !important;
  font-weight: 500;
}
.layout { grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 78px); align-items: stretch; }
aside { padding: 36px 14px 30px; border: 0; background: var(--navy); }
.navlabel { padding: 0 16px 19px; color: #8da2b3; font-size: 9px; letter-spacing: .2em; font-weight: 650; }
.nav {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 43px;
  margin: 4px 0;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #b7c6d3;
  font-size: 12px;
  font-weight: 450;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.nav::before { content: "01"; min-width: 17px; color: #8199ac; font-size: 9px; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.nav[data-page="returns"]::before { content: "02"; }
.nav[data-page="risk"]::before { content: "03"; }
.nav[data-page="consistency"]::before { content: "04"; }
.nav[data-page="monthly"]::before { content: "05"; }
.nav[data-page="annual"]::before { content: "06"; }
.nav[data-page="ledger"]::before { content: "07"; }
.nav[data-page="formulas"]::before { content: "08"; }
.nav:hover { background: #1c3a50; color: #fff; }
.nav.active { background: #254256; border-color: #395268; color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 var(--gold); }
.nav.active::before { color: #dfc59a; }
.nav:focus-visible { outline-color: #d6b983; }
.privacy {
  margin: 42px 12px 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid #385064;
  border-radius: 0;
  color: #a3b5c4;
  font-size: 10px;
  line-height: 1.8;
}
.privacy b { margin-bottom: 7px; color: #e3ebf2; font-size: 11px; font-weight: 550; }

/* Clear hierarchy, generous working area, and compact financial data. */
main { max-width: 1540px; margin: 0 auto; padding: 37px 42px 64px; min-width: 0; }
.head { align-items: center; gap: 24px; margin-bottom: 26px; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.eyebrow { margin-bottom: 11px; color: #6b7e90; font-size: 9px; font-weight: 650; letter-spacing: .16em; }
h1 { margin: 0 0 9px; color: #142c40; font-size: 31px; line-height: 1.18; font-weight: 550; letter-spacing: -.045em; }
.sub { max-width: 750px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.section { gap: 16px; margin: 30px 0 13px; align-items: baseline; }
.section h2 { color: #253c50; font-size: 14px; line-height: 1.5; font-weight: 620; letter-spacing: -.015em; }
.section span { color: #687b8d; font-size: 10px; line-height: 1.6; text-align: right; }
.panel, .metric, .insight { background: #fff; border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 2px 4px #10283c03; }
.panel { padding: 22px 24px; min-width: 0; }
.ptitle { gap: 16px; align-items: baseline; margin-bottom: 20px; }
.ptitle h3 { color: #253d51; font-size: 12px; font-weight: 600; line-height: 1.5; }
.ptitle span { color: #718395; font-size: 10px; line-height: 1.5; text-align: right; }
.metrics { gap: 14px; }
.metric { padding: 20px 20px 18px; border-top: 2px solid #b8c7d4; }
.metric:first-child { border-top-color: #214c68; }
.mlabel { min-height: 15px; margin-bottom: 12px; color: #5d7082; font-size: 10px; line-height: 1.5; font-weight: 550; letter-spacing: .005em; }
.mvalue { overflow: visible; color: #17364b; font-size: 26px; font-weight: 550; letter-spacing: -.045em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.mfoot { margin-top: 10px; color: #718292; font-size: 10px; line-height: 1.6; }
.pos { color: var(--teal); }
.neg { color: var(--loss); }
.twocol { gap: 16px; margin-top: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.distribution-grid { gap: 16px; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.twocol.plotgrid { grid-template-columns: minmax(0, 1fr); }
.table { width: 100%; color: #263e52; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.table th { padding: 12px; color: #617589; background: #f3f6f9; border-bottom: 1px solid #d7e0e8; font-size: 9px; line-height: 1.55; font-weight: 600; letter-spacing: .015em; }
.table td { padding: 12px 10px; border-bottom: 1px solid #e8edf2; line-height: 1.55; }
.table td:first-child { color: #5d7082; }
.table td:last-child { font-weight: 550; color: #1d3a50; }
.table tbody tr:hover td { background: #f7f9fb; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: #aebdca #f2f5f8; scrollbar-width: thin; }
.table-wrap::-webkit-scrollbar { height: 7px; }
.table-wrap::-webkit-scrollbar-track { background: #f2f5f8; }
.table-wrap::-webkit-scrollbar-thumb { background: #b3c1cc; border-radius: 8px; }
.wide-table { min-width: 1250px; }
#page-ledger .panel { overflow-x: auto; }
#ledgerTable { min-width: 750px; }
#classificationTable { font-size: 10px; }
#classificationTable td, #classificationTable th { padding-left: 7px; padding-right: 7px; }
#groupTable { min-width: 480px; }
.panel:has(> #groupTable), .panel:has(> #classificationTable) { overflow-x: auto; }
.subhead { padding-top: 18px; color: #294a63; font-size: 10px; letter-spacing: .09em; }
.pillnote { margin-left: 8px; padding: 4px 9px; border-color: #dbe4ec; color: #597185; background: #f7f9fb; border-radius: 3px; font-size: 9px; }

/* Forms are calm and legible, with one clear primary action. */
.btn { min-height: 39px; padding: 10px 17px; border: 1px solid #173f5c; border-radius: 3px; background: #173f5c; color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .01em; transition: background-color .15s ease, box-shadow .15s ease; }
.btn:hover { background: #0e2e46; box-shadow: 0 2px 5px #142f4320; }
.btn.alt { color: #294a62; border: 1px solid #c6d2dc; background: #fff; }
.btn.alt:hover { background: #eaf0f5; }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.upload { padding: 23px 25px; margin-bottom: 22px; border: 1px solid #cfdae3; border-left: 3px solid #9c835d; border-radius: 5px; background: #fff; }
.upload .left { gap: 18px; }
.uploadicon { flex: 0 0 43px; width: 43px; height: 43px; border: 1px solid #dbe4ec; border-radius: 3px; background: #eff4f8; color: #345a73; font-size: 21px; font-weight: 400; }
.upload h3 { margin-bottom: 6px; color: #263f53; font-size: 13px; font-weight: 600; }
.upload p { max-width: 650px; color: #6a7c8d; font-size: 11px; line-height: 1.7; }
.config { margin: 20px 0 12px; gap: 18px; color: #5d7082; font-size: 10px; line-height: 1.6; }
.config label { gap: 9px; }
.select { min-height: 35px; padding: 8px 10px; border: 1px solid #cdd8e2; border-radius: 3px; background: #fff; color: #29465d; font-size: 11px; line-height: 1.4; }
.select:hover { border-color: #8ba1b4; }
.control-grid { gap: 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.control-grid label, .mapping-form label { gap: 8px; color: #5a6e81; font-size: 10px; font-weight: 550; line-height: 1.5; }
.mapping-form { gap: 19px 22px; margin-top: 22px; }
.mapping-actions { margin-top: 22px; gap: 16px; }
.mapping-help { color: #687d8f; font-size: 10px; line-height: 1.8; }
.smallmuted, .emptyhint { margin-top: 14px; color: #667a8d; font-size: 10px; line-height: 1.85; }
.emptyhint { margin: 0; padding: 2px 0; }
.status { margin: 0 0 12px; color: #5e7487; font-size: 10px; line-height: 1.7; }
.status.good { color: #176e60; }
.status.error { color: #a33e3e; }
.advanced-controls { margin-bottom: 18px; }

/* Subtle chart chrome keeps attention on the series. */
.plot { height: 270px; }
.plot text { font-family: var(--site-font-body); font-size: 10px; fill: #6b8093; }
.plot .axis { stroke: #c2cfdb; opacity: .8; }
.plot .zero { stroke: #a9bac8; stroke-dasharray: 4 5; }
.plot .line { stroke: #177b71; stroke-width: 2.25; }
.plot .roll { stroke: #2f637f; stroke-width: 2.25; }
.plot .under { fill: #b84b4b0f; stroke: #ad5757; stroke-width: 2; }
.plot .histbar { fill: #5f8e9e; }
.hist .bar { background: #6d99a5; border-radius: 2px 2px 0 0; }
.plot-tooltip { padding: 8px 11px; border: 1px solid #38586e; border-radius: 3px; background: #102e44; color: #f3f7fa; font-size: 10px; box-shadow: 0 4px 15px #112b4326; }
.plot-hit:hover { fill: #1d7c73; fill-opacity: .18; stroke: #1d7c73; stroke-opacity: .5; }
.hist-wrap .hist-x, .hist-wrap .hist-y { color: #687f92; }
.insights { gap: 16px; }
.insight { padding: 21px 22px; border-top: 2px solid #bca272; }
.tag { margin-bottom: 12px; color: #7d6b4c; font-size: 9px; font-weight: 600; letter-spacing: .13em; }
.insight h3 { margin-bottom: 9px; color: #263f53; font-size: 12px; font-weight: 600; line-height: 1.55; }
.insight p { color: #64798b; font-size: 11px; line-height: 1.8; }
.methodgrid { gap: 25px; }
.methodgrid > div + div { padding-top: 22px; border-top: 1px solid #e5ebf0; }
.methodgrid b { color: #26465e; font-size: 12px; font-weight: 600; }
.methodgrid p { margin-top: 9px; color: #5b7387; font-size: 11px; line-height: 1.85; }
.methodology .formula { padding: 13px 16px; border: 1px solid #e3eaf0; border-radius: 3px; background: #f6f8fa; color: #29475e; font-size: 15px; line-height: 1.85; }
.note { color: #697f91; font-size: 10px; line-height: 1.85; margin-top: 23px; }
.foot { gap: 18px; padding: 18px 32px; border-top: 1px solid #dbe3eb; background: #edf1f5; color: #667d90; font-size: 9px; line-height: 1.7; }
.foot b { color: #35576f; font-weight: 600; }

@media (min-width: 1450px) {
  main { padding: 44px 52px 74px; }
  h1 { font-size: 35px; }
  .mvalue { font-size: 30px; }
  .plot { height: 300px; }
}
@media (max-width: 1180px) {
  .layout { grid-template-columns: 208px minmax(0, 1fr); }
  main { padding: 30px 28px 56px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insights { grid-template-columns: minmax(0, 1fr); }
  .insight { display: grid; grid-template-columns: 145px minmax(160px, 1fr) 1.7fr; gap: 20px; align-items: baseline; }
  .insight .tag, .insight h3 { margin: 0; }
  .twocol, .distribution-grid { grid-template-columns: minmax(0, 1fr); }
  .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mapping-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .top { height: 69px; padding: 0 19px; }
  .brand { font-size: 19px; gap: 11px; }
  .mark { width: 33px; height: 33px; font-size: 23px; }
  .top small { font-size: 7px; }
  .top > div:last-child:not(.brand) { font-size: 0 !important; letter-spacing: 0; }
  .top > div:last-child b { font-size: 11px; }
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: calc(100vh - 69px); }
  aside { position: sticky; top: 0; z-index: 6; display: flex; gap: 5px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid #334b5e; scrollbar-width: none; }
  aside::-webkit-scrollbar { display: none; }
  .navlabel, .privacy { display: none; }
  aside .nav { flex: 0 0 auto; min-height: 36px; margin: 0; padding: 8px 11px; font-size: 10px; gap: 7px; border-radius: 3px; }
  .nav::before { min-width: 13px; font-size: 8px; }
  .nav.active { box-shadow: inset 0 -2px 0 var(--gold); }
  main { padding: 26px 19px 44px; }
  .head { align-items: flex-start; gap: 17px; padding-bottom: 22px; margin-bottom: 22px; }
  h1 { font-size: 28px; }
  .eyebrow { font-size: 8px; line-height: 1.7; margin-bottom: 9px; }
  .sub { font-size: 11px; }
  .head > .btn { padding: 8px 11px; font-size: 10px; min-height: 35px; }
  .section { margin-top: 25px; gap: 10px; align-items: flex-start; }
  .section h2 { font-size: 13px; }
  .section span { max-width: 47%; font-size: 9px; }
  .panel { padding: 19px 17px; }
  .metrics { gap: 11px; }
  .metric { padding: 16px 15px; }
  .mlabel { font-size: 9px; margin-bottom: 10px; }
  .mvalue { font-size: 26px; }
  .mfoot { font-size: 9px; }
  .upload { padding: 20px; align-items: flex-start; gap: 18px; }
  .upload .left { gap: 13px; }
  .upload h3 { font-size: 12px; }
  .upload p { font-size: 10px; }
  .upload > div:last-child { margin-left: 56px; }
  .config { gap: 12px 18px; }
  .ptitle { gap: 12px; margin-bottom: 17px; }
  .ptitle h3 { font-size: 11px; }
  .ptitle span { font-size: 9px; max-width: 45%; }
  .table { font-size: 10px; }
  .table td { padding: 11px 7px; }
  .table th { padding: 10px 8px; }
  .table td:first-child { white-space: normal; }
  .wide-table td:first-child, #ledgerTable td:first-child { white-space: nowrap; }
  .plot { height: 235px; }
  .insight { display: block; padding: 20px; }
  .insight .tag { margin-bottom: 10px; }
  .insight h3 { margin-bottom: 8px; }
  .insight p { font-size: 10px; }
  .foot { padding: 16px 19px; font-size: 8px; }
}
@media (max-width: 480px) {
  .head { flex-wrap: wrap; }
  h1 { font-size: 27px; }
  .metrics { gap: 9px; }
  .metric { padding: 15px 12px; }
  .mvalue { font-size: 23px; }
  .mlabel { min-height: 27px; font-size: 9px; }
  .mfoot { min-height: 25px; }
  .mapping-form, .control-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .mapping-actions { gap: 12px; }
  .mapping-actions .btn { width: 100%; }
  .upload > div:last-child { width: 100%; margin-left: 0; }
  .upload .btn { width: 100%; }
  .select { max-width: 100%; }
  .section span { font-size: 8px; }
  .foot { flex-direction: column; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
@media print {
  .top { background: #fff; color: #10283c; border-bottom: 2px solid #10283c; }
  .top small { color: #536b80; }
  .mark { color: #10283c; border-color: #10283c; }
  aside, .upload, #mappingPanel, .config, .advanced-controls, .head > button, .foot { display: none; }
  .layout { display: block; }
  main { padding: 20px 0; }
  .panel, .metric, .insight { break-inside: avoid; box-shadow: none; }
}
