@font-face {
  font-family: "Barlow Condensed Fallback";
  src: local("Arial Narrow"), local("Arial");
  size-adjust: 78%;
  ascent-override: 92%;
  descent-override: 22%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "IBM Plex Sans Fallback";
  src: local("Arial");
  size-adjust: 104%;
  ascent-override: 95%;
  descent-override: 24%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/barlow-condensed-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+00B7, U+00D7, U+00F7, U+2212, U+2264-2265;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+00B7, U+00D7, U+00F7, U+2212, U+2264-2265;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+00B7, U+00D7, U+00F7, U+2212, U+2264-2265;
}

:root {
  --canvas: #161c25;
  --panel: #212b37;
  --panel-2: #2d3947;
  --citron: #dfff32;
  --citron-hover: #c8ec20;
  --ink: #161c25;
  --text: #eef4f4;
  --muted: #bac8d3;
  --line: #8193a5;
  --panel-line: #526679;
  --electric: #3857ff;
  --link: #b4c5ff;
  --caution: #ffe1a0;
  --danger: #ffb9be;
  --display: "Barlow Condensed", "Barlow Condensed Fallback", sans-serif;
  --body: "IBM Plex Sans", "IBM Plex Sans Fallback", sans-serif;
  color-scheme: dark;
}

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

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  font-variant-numeric: lining-nums;
}

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

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--citron);
  outline-offset: 2px;
}
.btn:focus-visible,
.wordmark:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  box-shadow: inset 0 0 0 2px var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 5;
  background: var(--citron);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 600;
}
.skip:focus { top: 8px; }

.wrap {
  width: min(1200px, calc(100% - 80px));
  margin-inline: auto;
}

.site-header { border-bottom: 1px solid var(--panel-line); }
.bar {
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  text-decoration: underline;
  text-decoration-color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
}
.nav-mark {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 3px;
  background: var(--citron);
  opacity: 0;
  pointer-events: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-links a {
  color: var(--link);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

h1, h2, .wordmark {
  font-variant-numeric: tabular-nums lining-nums;
}
h1, h2, h3, p, li, dd, dt, label, .hint, .flag, .notice, .result-value, caption {
  overflow-wrap: anywhere;
  max-width: 100%;
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 52px;
  line-height: 1;
  letter-spacing: 0;
}
h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
}
h3 {
  margin: 0 0 8px;
  font-family: var(--body);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
}
p { margin: 0 0 16px; }
.prose p, .prose li, .notice { max-width: min(66ch, 100%); }
.prose a + a, .takeaways a + a { margin-left: 4px; }

a { color: var(--link); }
.prose a, .takeaways a, .notice a, .site-footer a, .crumbs a { text-decoration: underline; text-underline-offset: 3px; }

.crumbs { margin: 16px 0; }
.crumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.4;
}
.crumbs li { display: inline; }
.crumbs li:not(:last-child)::after {
  content: " / ";
  color: var(--muted);
}

.slash {
  position: relative;
  height: 8px;
  margin: 12px 0 8px;
  display: flex;
  gap: 8px;
}
.slash span {
  display: block;
  height: 8px;
}
.slash .slash-citron {
  flex: 1.6;
  background: var(--citron);
  clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
}
.slash .slash-blue {
  width: 120px;
  background: var(--electric);
  clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%);
}
.slash-sheen {
  position: absolute;
  inset: 0;
  background: var(--text);
  opacity: 0;
  pointer-events: none;
}

.notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.55;
  max-width: min(66ch, 100%);
}
.notice strong, .flag span { min-width: 0; font-weight: 600; }
.flag span { font-weight: 400; }
.flag span strong { font-weight: 600; }
.dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 9px;
  background: var(--citron);
}
.notice-compact { margin-top: 16px; }

.takeaways { margin-top: 24px; }
.takeaways ul {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.takeaways li {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  padding: 16px;
  min-height: 52px;
}
.takeaways li::before {
  content: "";
  display: block;
  width: 32px;
  height: 8px;
  margin-bottom: 12px;
  background: var(--citron);
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}

.workbench, .areas-grid, .tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 776fr) minmax(0, 400fr);
  gap: 24px;
  align-items: start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.wrap, main, article, .tool-shell, .rule-strip, .tool-layout > *, .panel, .result-panel, .result-body, .flag, .takeaways, .takeaways li, .workbench > * {
  min-width: 0;
  max-width: 100%;
}
.workbench, .areas, .rule-strip, .tool-shell, .prose section { margin-top: 48px; }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  padding: 24px;
}
.accent {
  position: absolute;
  inset: 0;
  border: 2px solid var(--citron);
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
}
.panel.is-committed,
.tool-layout.is-calculated .result-panel { border-color: var(--citron); }

.field { margin-bottom: 12px; }
label, .label {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--citron);
}
label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

input, select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--canvas);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 400 16px/1.4 var(--body);
  font-variant-numeric: tabular-nums lining-nums;
}
select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23EEF4F4' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.hint, .field-error, .table-hint, .selector-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
}
.field-error { color: var(--danger); }
.time-row, .split { display: flex; gap: 12px; }
.time-row .field, .split .field { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--citron);
  color: var(--ink);
  border: 1px solid var(--citron);
  border-radius: 8px;
  font: 600 16px/1.4 var(--body);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--citron-hover); }
.btn:disabled {
  background: var(--citron);
  color: var(--ink);
  border-color: var(--citron);
  opacity: 1;
}
[hidden] { display: none !important; }
.btn-ghost {
  width: auto;
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--panel-2); }
.actions { display: flex; flex-direction: column; align-items: stretch; }

.rule-grid, .review-list dl {
  display: grid;
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}
.rule-grid dt, .review-list dt {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
.rule-grid dd, .review-list dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
}
.source-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.source-kicker svg { color: var(--citron); }

.flag {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--caution);
  border-radius: 6px;
  color: var(--caution);
  font-size: 16px;
  line-height: 1.45;
}
.flag strong { color: var(--text); }
.flag svg { flex: 0 0 16px; margin-top: 3px; }

.howto { margin: 16px 0 0; padding-left: 24px; }
.howto li { margin: 0 0 8px; }
.calc-page .tool-shell { margin-top: 16px; }
.calc-page .crumbs { margin: 8px 0; }
.calc-page .slash { margin: 8px 0; }
.rule-overview h2 { margin-bottom: 8px; }
.overview {
  display: grid;
  grid-template-columns: 7.75rem minmax(0, 1fr);
  gap: 4px 12px;
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}
.overview dt { color: var(--muted); font-weight: 600; }
.overview dd { margin: 0; }
.status-note { color: var(--caution); font-weight: 600; }
.source-details { margin-top: 8px; border-top: 1px solid var(--panel-line); }
.source-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
.source-details p { margin: 0 0 12px; }
.stage { margin: 0 0 8px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.stage-help { margin: 0 0 12px; }

.branch-grid, .pay-stack { display: grid; gap: 16px; }
.branch-grid { grid-template-columns: 1fr 1fr; }
.eyebrow {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.area-card {
  display: flex;
  gap: 12px;
  min-height: 44px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.area-card h3 {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.area-card p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.45; }
.icon-tile {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--electric);
  color: var(--citron);
  border-radius: 6px;
}
.fit-panel, .pay-stack .area-card { min-width: 0; }
.guide-tag {
  display: inline-block;
  margin-top: 8px;
  color: var(--caution);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.table-scroll {
  display: block;
  overflow-x: auto;
  min-width: 0;
  max-width: 100%;
  margin: 16px 0 24px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums lining-nums;
}
caption {
  caption-side: top;
  padding: 12px 16px;
  text-align: left;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}
th, td {
  padding: 12px 16px;
  height: 52px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  white-space: normal;
}
.table-scroll table {
  width: max-content;
  min-width: 100%;
}
th { background: var(--panel-2); font-weight: 600; }
td { border-top: 1px solid var(--line); }
.num, td.num, th.num { text-align: right; }

.result-value {
  margin: 0 0 16px;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums lining-nums;
}
.result-body { min-height: 180px; }
.result-panel { min-height: 280px; }
.live-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.error-summary {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
}
.error-summary a { color: var(--danger); }

.figure { margin-top: 32px; }
.figure img {
  display: block;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
}
.figure figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.site-footer {
  margin-top: 64px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--panel-line);
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}
.ext { font-weight: 400; }

ul, ol { margin: 0 0 16px; padding-left: 24px; }
li { margin: 0 0 8px; }

@media (max-width: 899px) {
  .workbench, .areas-grid, .tool-layout { grid-template-columns: 1fr; gap: 16px; }
  .takeaways ul, .branch-grid { grid-template-columns: 1fr; }
}
@media (max-width: 699px) {
  .wrap { width: min(1200px, calc(100% - 32px)); }
  .rule-grid, .review-list dl { grid-template-columns: 1fr; }
  h1 { font-size: 36px; line-height: 1.05; }
  h2 { font-size: 28px; }
  .panel, .selector, .source-rail, .result-panel { padding: 16px; }
  .workbench, .areas, .rule-strip, .tool-shell, .prose section { margin-top: 32px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: 8px;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 8px 0; }
  .tool-layout.is-calculated { display: flex; flex-direction: column; }
  .tool-layout.is-calculated .result-panel { order: -1; }
  .slash .slash-blue { width: 72px; }
}

@media (prefers-reduced-motion: no-preference) {
  .area-card:hover { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .area-card:hover { transform: none; }
}

@media print {
  body { background: #fff; color: #111; }
  .site-header, .slash, .accent, .nav-toggle, .btn { display: none; }
  a { color: #111; }
  .panel, .takeaways li, .area-card { border-color: #111; }
}
