:root {
  --ink: var(--mf-ink, #262626);
  --muted: var(--mf-muted, #808080);
  --accent: var(--mf-blue, #4472C4);
  --line: var(--mf-gridline, #D9D9D9);
  --panel: #fafafa;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--mf-bg, #fff); color: var(--ink); font-family: var(--mf-font, Literata, Georgia, serif); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 16px 80px; }
a { color: var(--accent); }
.crumb { font-size: 14px; margin: 0 0 22px; }
h1 { font-size: 34px; line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 22px; margin: 34px 0 6px; }
h3 { font-size: 17px; margin: 22px 0 6px; }
.sub { color: var(--muted); font-size: 17px; margin: 0 0 22px; max-width: 820px; line-height: 1.5; }
.note { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 12px; max-width: 900px; }
.hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.hint2 { font-size: 12.5px; color: var(--muted); line-height: 1.4; margin: 2px 0 6px; }

/* controls */
.controls { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px 8px; background: var(--panel); margin-bottom: 14px; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: flex-start; margin-bottom: 12px; }
.ctl-row.inline { margin: 6px 0 10px; }
.ctl label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.ctl input[type="date"], .ctl select { font-family: inherit; font-size: 14px; height: 36px; padding: 0 8px; border: 1px solid #ccc; border-radius: 5px; background: #fff; color: var(--ink); }
.ctl select { min-width: 150px; }
/* segmented buttons: every button in a group one fixed size; labels wrap inside it rather than
   being cut off. Each button carries its own border so a group that wraps onto a second row
   still reads as a grid. */
.seg { display: inline-flex; flex-wrap: wrap; padding: 0 1px 1px 0; }
.seg button { font-family: inherit; font-size: 13.5px; line-height: 1.2; width: 122px; height: 48px; margin: 0 -1px -1px 0; border: 1px solid #ccc; background: #fff; color: var(--ink); cursor: pointer; padding: 0 8px; white-space: normal; overflow-wrap: break-word; }
#seg-layer button { width: 176px; }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; position: relative; z-index: 1; }
.seg.small button { width: 96px; height: 32px; font-size: 13px; }
.seg button:disabled { background: #f1f1f1; color: #b5b5b5; cursor: not-allowed; }
.seg button:disabled[aria-pressed="true"] { background: #f1f1f1; border-color: #ccc; color: #b5b5b5; font-weight: 400; }

/* hero */
.hero { border: 1px solid var(--line); border-left: 5px solid var(--accent); background: var(--panel); border-radius: 6px; padding: 20px 22px; margin: 0 0 10px; }
.hero .kicker { text-transform: uppercase; letter-spacing: .09em; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.hero .lede { font-size: 20px; line-height: 1.4; margin: 0 0 14px; max-width: 920px; }
.heronums { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 2px; }
.hn { flex: 1 1 118px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 86px; }
.hn .v { font-size: 26px; font-weight: 700; line-height: 1.1; }
.hn .l { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.hn .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* charts */
.chart { width: 100%; min-height: 120px; margin: 4px 0 10px; }
.chart svg { max-width: 100%; height: auto; font-family: inherit; }
.chart figure { margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 820px) { .two { grid-template-columns: 1fr; } }

/* tables: every column centered */
.table-wrap { overflow-x: auto; margin: 6px 0 10px; }
.tbl { border-collapse: collapse; font-size: 13.5px; width: 100%; }
.tbl th, .tbl td { text-align: center; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tbl.wrapcells td { white-space: normal; min-width: 90px; }
.tbl td.pos { color: var(--mf-red, #C00000); }
.tbl td.neg { color: var(--mf-blue, #4472C4); }

/* methods */
.methods { margin-top: 36px; }
.methods p, .methods li { font-size: 14px; line-height: 1.55; }
.methods .gate { border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; background: var(--panel); margin: 10px 0 14px; }
.methods .gate.ok { border-left: 5px solid var(--mf-green, #70AD47); }
.methods .gate.bad { border-left: 5px solid var(--mf-red, #C00000); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -2px; }
