:root {
  --paper: #f7f7f5;
  --paper-strong: #ffffff;
  --ink: #110e08;
  --buy: #ccff00;
  --muted: #65655f;
  --rule: #c9c9c1;
  --positive: #567500;
  --negative: #c92e29;
  --builder: #5ea7ff;
  --official: #ccff00;
  --sans: "Hanken Grotesk", Arial, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--mono); scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--paper); }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }

.skip-link {
  position: fixed;
  z-index: 500;
  top: 10px;
  left: 10px;
  padding: 10px 13px;
  transform: translateY(-180%);
  border: 1px solid var(--ink);
  background: var(--buy);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}
.skip-link:focus { transform: translateY(0); }

.bagwork-fallback-header {
  width: min(1480px, calc(100% - 64px));
  min-height: 62px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  font-size: 10px;
  text-transform: uppercase;
}
.bagwork-fallback-header a { font-family: var(--sans); font-size: 15px; font-weight: 900; text-decoration: none; }
.bagwork-fallback-header span { color: var(--muted); }

main { width: min(1480px, calc(100% - 64px)); margin: 0 auto; }
.eyebrow { margin: 0 0 16px; color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; }
.section-copy { max-width: 70ch; margin: 15px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }

.bagwork-hero {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  align-items: end;
  gap: 72px;
  padding: 88px 0 52px;
  border-bottom: 1px solid var(--ink);
}
.hero-title h1,
.section-heading h2,
.output-section h2,
.method-section h2,
.suggestion-copy h2 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .82;
  text-transform: uppercase;
}
.hero-title h1 { max-width: 9ch; font-size: clamp(78px, 10vw, 142px); }
.hero-brief { padding-bottom: 3px; }
.hero-thesis { max-width: 19ch; margin: 0 0 22px; font-family: var(--sans); font-size: 31px; font-weight: 850; line-height: 1.02; }
.hero-brief > p:nth-child(2) { max-width: 52ch; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.record-state {
  min-height: 44px;
  margin-top: 36px;
  padding-top: 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-top: 1px solid var(--rule);
  font-size: 9px;
  text-transform: uppercase;
}
.record-state i { width: 9px; height: 9px; border: 1px solid var(--ink); border-radius: 50%; background: var(--buy); box-shadow: 0 0 0 4px rgb(204 255 0 / 24%); }
.record-state.is-error i { background: var(--negative); box-shadow: none; }

.latest-band { display: grid; grid-template-columns: minmax(0, 1fr) minmax(520px, .92fr); border-bottom: 1px solid var(--ink); }
.latest-heading { min-height: 264px; padding: 42px 40px 38px 0; display: flex; flex-direction: column; justify-content: flex-end; }
.latest-heading h2 { margin: 0 0 13px; font-family: var(--sans); font-size: 39px; font-weight: 850; letter-spacing: -.025em; line-height: 1; }
.latest-heading > p:last-child { max-width: 66ch; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.latest-facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 1px solid var(--ink); }
.latest-facts div { min-height: 132px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.latest-facts div:nth-child(n + 3) { border-bottom: 0; }
.latest-facts dt { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.latest-facts dd { margin: 0; font-family: var(--sans); font-size: 27px; font-weight: 850; line-height: .95; }
.latest-facts div:first-child { background: var(--buy); }
.latest-facts div:first-child dt { color: var(--ink); }

.analytics-section, .ledger-section { padding: 78px 0; border-bottom: 1px solid var(--ink); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 30px; }
.section-heading h2, .output-section h2, .method-section h2, .suggestion-copy h2 { font-size: clamp(48px, 6vw, 78px); }
.analytics-heading > div:first-child, .ledger-heading > div:first-child { min-width: 0; }
.range-control { flex: 0 0 auto; display: flex; border: 1px solid var(--ink); }
.range-control button { min-width: 72px; min-height: 42px; padding: 0 15px; border: 0; border-right: 1px solid var(--ink); background: transparent; font-size: 9px; }
.range-control button:last-child { border-right: 0; }
.range-control button[aria-pressed="true"] { background: var(--buy); font-weight: 700; }

.metric-control { display: flex; align-items: stretch; overflow-x: auto; border: 1px solid var(--ink); border-bottom: 0; scrollbar-width: thin; }
.metric-control button { min-height: 48px; flex: 1 0 auto; padding: 0 17px; border: 0; border-right: 1px solid var(--rule); background: var(--paper); color: var(--muted); font-size: 9px; text-transform: uppercase; white-space: nowrap; }
.metric-control button:last-child { border-right: 0; }
.metric-control button[aria-pressed="true"] { background: var(--ink); color: var(--buy); font-weight: 700; }

.analytics-instrument { display: grid; grid-template-columns: minmax(0, 1fr) 286px; border: 1px solid var(--ink); }
.chart-panel { min-width: 0; background: var(--ink); color: var(--paper); }
.chart-toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-right: 18px; border-bottom: 1px solid #45443f; }
.account-control { align-self: stretch; display: flex; }
.account-control button { min-width: 106px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-right: 1px solid #45443f; background: transparent; color: #b7b7b0; font-size: 9px; text-transform: uppercase; }
.account-control button[aria-pressed="true"] { background: #22211e; color: var(--paper); }
.legend-dot { width: 8px; height: 8px; display: inline-block; }
.legend-official { background: var(--official); }
.legend-builder { background: var(--builder); }
.chart-toolbar > span { color: #a4a49d; font-size: 8px; text-transform: uppercase; }
.chart-stage { position: relative; height: 408px; overflow: hidden; }
#analyticsChart { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.chart-grid-line { stroke: #34332f; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis-label { fill: #8f8f88; font-family: var(--mono); font-size: 15px; }
.chart-line { fill: none; stroke: var(--series-color); stroke-linecap: square; stroke-linejoin: miter; stroke-width: 4; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--ink); stroke: var(--series-color); stroke-width: 4; vector-effect: non-scaling-stroke; }
.chart-guide { stroke: #e8e8e2; stroke-width: 1; stroke-dasharray: 5 7; vector-effect: non-scaling-stroke; opacity: 0; }
.chart-guide.is-visible { opacity: .65; }
.chart-empty { fill: #a4a49d; font-family: var(--mono); font-size: 16px; text-anchor: middle; }
.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 185px;
  max-width: 250px;
  padding: 11px 12px;
  border: 1px solid var(--paper);
  background: var(--ink);
  color: var(--paper);
  pointer-events: none;
  font-size: 9px;
  line-height: 1.5;
}
.chart-tooltip strong { display: block; margin-bottom: 4px; color: var(--buy); font-family: var(--sans); font-size: 22px; line-height: 1; }
.chart-tooltip span { display: block; }
.chart-tooltip .builder-value { color: var(--builder); }
.chart-footer { min-height: 52px; padding: 0 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; border-top: 1px solid #45443f; color: #a4a49d; font-size: 8px; text-transform: uppercase; }
.chart-footer strong { color: var(--buy); font-size: 9px; text-align: center; }
.chart-footer span:last-child { text-align: right; }

.analytics-notes { display: grid; grid-template-rows: repeat(4, 1fr) auto; background: var(--paper); }
.analytics-notes > div { min-height: 84px; padding: 17px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--rule); }
.analytics-notes span { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.analytics-notes strong { font-family: var(--sans); font-size: 17px; line-height: 1.04; }
.analytics-notes > a { min-height: 56px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; background: var(--buy); font-size: 9px; font-weight: 700; text-decoration: none; text-transform: uppercase; }

.account-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.account-card { min-width: 0; padding: 24px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--ink); }
.account-card:last-child { border-right: 0; }
.account-card-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.account-card-head span { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.account-card-head h3 { margin: 5px 0 0; font-family: var(--sans); font-size: 28px; line-height: 1; }
.account-card-delta { padding: 7px 9px; border: 1px solid var(--rule); font-size: 8px; text-transform: uppercase; }
.account-card-delta.is-positive { border-color: var(--positive); color: var(--positive); }
.account-card-delta.is-negative { border-color: var(--negative); color: var(--negative); }
.account-card-metrics { margin: 22px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.account-card-metrics div { min-width: 0; padding: 15px 10px 0 0; }
.account-card-metrics dt { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.account-card-metrics dd { margin: 6px 0 0; overflow-wrap: anywhere; font-family: var(--sans); font-size: 21px; font-weight: 850; line-height: 1; }

.analytics-table-shell { overflow-x: auto; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.analytics-table { width: 100%; min-width: 940px; border-collapse: collapse; background: var(--paper-strong); font-size: 9px; }
.analytics-table caption { padding: 13px 15px; border-bottom: 1px solid var(--rule); color: var(--muted); text-align: left; text-transform: uppercase; }
.analytics-table th, .analytics-table td { padding: 12px 14px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.analytics-table th:first-child, .analytics-table td:first-child, .analytics-table th:nth-child(2), .analytics-table td:nth-child(2) { text-align: left; }
.analytics-table th { color: var(--muted); font-weight: 600; text-transform: uppercase; }
.analytics-table tbody tr:last-child td { border-bottom: 0; }
.analytics-table td:last-child, .analytics-table th:last-child { border-right: 0; }

.ledger-heading { align-items: end; }
.day-filter { flex: 0 0 230px; }
.day-filter span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.day-filter select { width: 100%; min-height: 42px; padding: 0 38px 0 12px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); font-size: 9px; text-transform: uppercase; }
.ledger { border-top: 1px solid var(--ink); }
.ledger-day { border-bottom: 1px solid var(--ink); }
.ledger-day-head { min-height: 134px; display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(260px, .7fr); align-items: center; gap: 30px; padding: 24px 0; }
.ledger-day-head time { font-family: var(--sans); font-size: 28px; font-weight: 900; }
.ledger-day-head h3 { margin: 0; font-family: var(--sans); font-size: 31px; line-height: 1; }
.ledger-day-head p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.work-list { border-top: 1px solid var(--rule); }
.work-item { min-height: 120px; display: grid; grid-template-columns: 170px minmax(0, 1.2fr) minmax(250px, .8fr); gap: 30px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.work-item:last-child { border-bottom: 0; }
.work-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.work-state, .work-category { padding: 5px 7px; border: 1px solid var(--ink); font-size: 7px; text-transform: uppercase; }
.work-state[data-state="live"] { background: var(--buy); }
.work-state[data-state="submitted"] { background: var(--ink); color: var(--paper); }
.work-state[data-state="pending"] { border-style: dashed; }
.work-state[data-state="prepared"] { color: var(--muted); }
.work-category { border-color: var(--rule); color: var(--muted); }
.work-copy h4 { margin: 0; font-family: var(--sans); font-size: 22px; line-height: 1.08; }
.work-impact p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.evidence-links { margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; }
.evidence-links a { font-size: 8px; font-weight: 700; text-transform: uppercase; }
.loading-copy, .ledger-empty { padding: 42px 0; color: var(--muted); font-size: 10px; text-transform: uppercase; }

.output-section { min-height: 300px; padding: 64px 0; display: grid; grid-template-columns: minmax(280px, .42fr) minmax(0, .58fr); gap: 64px; align-items: end; border-bottom: 1px solid var(--ink); }
.output-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--ink); }
.output-board article { min-height: 178px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--ink); }
.output-board article:first-child { background: var(--buy); }
.output-board article:last-child { border-right: 0; }
.output-board span, .output-board small { font-size: 8px; text-transform: uppercase; }
.output-board small { color: var(--muted); line-height: 1.4; }
.output-board article:first-child small { color: var(--ink); }
.output-board strong { font-family: var(--sans); font-size: 58px; font-weight: 900; line-height: .85; }

.method-section { padding: 72px 0; display: grid; grid-template-columns: minmax(260px, .34fr) minmax(0, .66fr); gap: 64px; border-bottom: 1px solid var(--ink); }
.method-section dl { margin: 0; border-top: 1px solid var(--ink); }
.method-section dl > div { padding: 18px 0; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 28px; border-bottom: 1px solid var(--rule); }
.method-section dt { font-size: 9px; font-weight: 700; }
.method-section dd { max-width: 68ch; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.65; }

.suggestion-section { display: grid; grid-template-columns: minmax(300px, .42fr) minmax(0, .58fr); border-bottom: 1px solid var(--ink); background: var(--ink); color: var(--paper); }
.suggestion-copy { padding: 64px 52px 64px 0; }
.suggestion-copy .eyebrow { color: var(--buy); }
.suggestion-copy h2 { max-width: 8ch; }
.suggestion-copy > p:last-child { max-width: 46ch; margin: 28px 0 0; color: #b7b7b0; font-size: 11px; line-height: 1.7; }
.suggestion-form { padding: 64px 0 64px 52px; border-left: 1px solid #45443f; }
.suggestion-form > label:not(.suggestion-notice) { display: block; margin-bottom: 20px; }
.suggestion-form > label > span:first-child { display: block; margin-bottom: 8px; color: #b7b7b0; font-size: 8px; text-transform: uppercase; }
.suggestion-form select, .suggestion-form textarea { width: 100%; border: 1px solid #75746e; border-radius: 0; background: #1b1a17; color: var(--paper); outline: 0; }
.suggestion-form select { min-height: 46px; padding: 0 12px; }
.suggestion-form textarea { min-height: 154px; padding: 14px; resize: vertical; font-family: var(--sans); font-size: 17px; line-height: 1.45; }
.suggestion-form select:focus, .suggestion-form textarea:focus { border-color: var(--buy); box-shadow: inset 4px 0 0 var(--buy); }
.suggestion-message { position: relative; }
.suggestion-message small { position: absolute; right: 10px; bottom: 9px; color: #8d8c85; font-size: 8px; }
.suggestion-notice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; color: #b7b7b0; font-size: 9px; line-height: 1.6; }
.suggestion-notice input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--buy); }
.suggestion-notice a { color: var(--paper); }
.suggestion-action { margin-top: 24px; display: grid; grid-template-columns: minmax(190px, auto) minmax(0, 1fr); align-items: center; gap: 18px; }
.suggestion-action button { min-height: 52px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 26px; border: 0; background: var(--buy); color: var(--ink); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.suggestion-action button:disabled { opacity: .56; cursor: wait; }
.suggestion-action p { margin: 0; color: #9d9c95; font-size: 8px; line-height: 1.6; }
.suggestion-action p.is-success { color: var(--buy); }
.suggestion-action p.is-error { color: #ff786f; }
.form-trap { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }

.bagwork-footer { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.bagwork-footer div { display: flex; gap: 22px; }
.bagwork-footer a:hover { color: var(--ink); }
.no-script { margin: 0; padding: 15px 32px; border-top: 1px solid var(--ink); background: var(--buy); color: var(--ink); font-size: 10px; text-align: center; }

button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid var(--buy); outline-offset: 3px; }

@media (max-width: 1050px) {
  .bagwork-hero { grid-template-columns: minmax(0, 1fr) 330px; gap: 42px; }
  .hero-thesis { font-size: 27px; }
  .latest-band { grid-template-columns: 1fr; }
  .latest-facts { border-top: 1px solid var(--ink); border-left: 0; }
  .analytics-instrument { grid-template-columns: 1fr; }
  .analytics-notes { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: auto auto; }
  .analytics-notes > div { border-right: 1px solid var(--rule); }
  .analytics-notes > a { grid-column: 1 / -1; }
  .account-card-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-day-head, .work-item { grid-template-columns: 145px minmax(0, 1fr) minmax(220px, .7fr); gap: 20px; }
}

@media (max-width: 760px) {
  .bagwork-fallback-header, main { width: 100%; padding-right: 18px; padding-left: 18px; }
  .bagwork-hero { min-height: 0; grid-template-columns: 1fr; align-items: start; gap: 42px; padding: 58px 0 38px; }
  .hero-title h1 { font-size: clamp(62px, 19vw, 88px); }
  .hero-thesis { font-size: 25px; }
  .latest-heading { min-height: 230px; padding-right: 0; }
  .latest-heading h2 { font-size: 32px; }
  .latest-facts { grid-template-columns: 1fr 1fr; }
  .latest-facts div { min-height: 116px; padding: 17px 13px; }
  .latest-facts dd { font-size: 22px; }
  .analytics-section, .ledger-section { padding: 56px 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .section-heading h2, .output-section h2, .method-section h2, .suggestion-copy h2 { font-size: 47px; }
  .range-control { width: 100%; }
  .range-control button { flex: 1; }
  .metric-control { margin-right: -18px; margin-left: -18px; border-right: 0; border-left: 0; }
  .chart-toolbar { min-height: 100px; align-items: stretch; flex-direction: column; gap: 0; padding: 0; }
  .account-control { min-height: 56px; }
  .account-control button { flex: 1; min-width: 0; padding: 0 7px; }
  .chart-toolbar > span { min-height: 44px; padding: 0 12px; display: flex; align-items: center; border-top: 1px solid #45443f; }
  .chart-stage { height: 310px; }
  .chart-footer { grid-template-columns: 1fr 1fr; }
  .chart-footer strong { grid-column: 1 / -1; grid-row: 1; }
  .analytics-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-notes > div { min-height: 86px; }
  .account-cards { grid-template-columns: 1fr; }
  .account-card { border-right: 0; }
  .account-card-head h3 { font-size: 25px; }
  .account-card-metrics dd { font-size: 20px; }
  .day-filter { width: 100%; flex-basis: auto; }
  .ledger-day-head { grid-template-columns: 1fr; gap: 12px; padding: 28px 0; }
  .ledger-day-head time { font-size: 22px; }
  .ledger-day-head h3 { font-size: 27px; }
  .work-item { grid-template-columns: 1fr; gap: 12px; align-items: start; padding: 22px 0; }
  .work-copy h4 { font-size: 21px; }
  .output-section, .method-section, .suggestion-section { grid-template-columns: 1fr; gap: 38px; }
  .output-section, .method-section { padding: 56px 0; }
  .output-board strong { font-size: 46px; }
  .method-section dl > div { grid-template-columns: 1fr; gap: 9px; }
  .suggestion-section { margin-right: -18px; margin-left: -18px; padding: 0 18px; }
  .suggestion-copy { padding: 56px 0 0; }
  .suggestion-form { padding: 0 0 56px; border-left: 0; }
  .suggestion-action { grid-template-columns: 1fr; }
  .bagwork-footer { align-items: flex-start; flex-direction: column; padding: 26px 0; }
  .bagwork-footer div { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .latest-facts { grid-template-columns: 1fr; }
  .latest-facts div, .latest-facts div:nth-child(n + 3) { border-bottom: 1px solid var(--rule); }
  .latest-facts div:last-child { border-bottom: 0; }
  .analytics-notes { grid-template-columns: 1fr; }
  .account-card { padding: 19px 14px; }
  .account-card-head { align-items: stretch; flex-direction: column; }
  .account-card-delta { align-self: flex-start; }
  .output-board { grid-template-columns: 1fr; }
  .output-board article { border-right: 0; border-bottom: 1px solid var(--ink); }
  .output-board article:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
