:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #444444;
  --faint: #6a6a6a;
  --line: #d0d0cc;
  --accent: #1558d6;
  --accent-hover: #0d46b5;
  --accent-soft: #e8effc;
  --ok: #0b6b34;
  --warn: #9a4a00;
  --bad: #b42318;
  --radius: 8px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
code, kbd { font-family: var(--mono); font-size: 0.9em; }

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  z-index: 10;
}
.skip:focus { left: 8px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.logo img {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
}
.logo:hover { color: var(--accent); }
.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--ink); }

main {
  flex: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.breadcrumbs { font-size: 0.875rem; color: var(--muted); margin: 0 0 1rem; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 0.35rem; color: var(--faint); }
.breadcrumbs [aria-current="page"] { color: var(--ink); }

h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}
.lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 0.75rem; max-width: 62ch; }
.intro { margin: 0 0 1.5rem; max-width: 68ch; color: var(--ink); }

h2 { font-size: 1.15rem; margin: 0 0 0.75rem; letter-spacing: -0.02em; }

.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.tool-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 720px) {
  .tool-grid.split { grid-template-columns: 1fr 1fr; }
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0 0 0.35rem;
}
.hint { display: block; font-weight: 400; color: var(--faint); font-size: 0.8rem; margin-top: 0.15rem; }

input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #bdbdb8;
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
}
textarea { min-height: 8rem; resize: vertical; font-family: var(--mono); font-size: 0.875rem; line-height: 1.45; }
textarea.plain { font-family: var(--sans); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.field { margin-bottom: 0.85rem; }
.row { display: grid; gap: 0.75rem; }
@media (min-width: 560px) {
  .row.cols-2 { grid-template-columns: 1fr 1fr; }
  .row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.checks label, .inline-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  margin: 0;
}
.inline-check { margin-top: 0.4rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
button, .btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
button.secondary:hover, .btn.secondary:hover { background: #eee; }
button.ghost {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}
button.ghost:hover { background: var(--accent-soft); color: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.output, pre.output {
  background: #111111;
  color: #f2f2f0;
  border-radius: 6px;
  padding: 0.85rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 6rem;
}
.output.empty { color: #9a9a96; }

.status {
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
  color: var(--muted);
}
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }

.counter {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.95rem;
}
.counter.ok { color: var(--ok); }
.counter.warn { color: var(--warn); }
.counter.bad { color: var(--bad); }

.pair {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  background: #fafafa;
}
.pair-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.cards {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 840px) {
  .cards { grid-template-columns: 1fr 1fr 1fr; }
}
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  color: inherit;
  text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 0.35rem; font-size: 1rem; color: var(--ink); }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.2rem;
}

.section { margin: 2rem 0 1.25rem; }
.section h2 { font-size: 1.25rem; margin-bottom: 0.35rem; }
.section > p { margin: 0 0 0.85rem; color: var(--muted); }

.home-intro { margin: 0.5rem 0 1.5rem; }
.home-intro p { max-width: 62ch; color: var(--muted); }

.related {
  margin-top: 0.5rem;
}
.related ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.related a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  text-decoration: none;
  color: var(--ink);
}
.related a:hover { border-color: var(--accent); color: var(--accent); }
.related a span { display: block; color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.preview-iframe {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1rem;
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
  background: var(--surface);
}
.site-footer p { margin: 0; }

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

.pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

table.csv-preview {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  overflow: auto;
  display: block;
}
table.csv-preview th, table.csv-preview td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
  text-align: left;
  white-space: nowrap;
}
table.csv-preview th { background: #eee; }

.ad-slot {
  margin: 1.25rem 0;
  min-height: 90px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 0.8rem;
}
.ad-slot.live {
  border-style: solid;
  min-height: 0;
  background: transparent;
  display: block;
}

.row.cols-5 { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .row.cols-5 { grid-template-columns: repeat(5, 1fr); }
}

table.flow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.flow-table th,
table.flow-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.35rem;
  text-align: left;
  vertical-align: middle;
}
table.flow-table th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}
table.flow-table td:last-child { width: 5.5rem; }
.xirr-result {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: 0.35rem 0 0.15rem;
}
.next-runs {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.next-runs li { padding: 0.2rem 0; border-bottom: 1px solid var(--line); }
.preset-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.85rem; }

table.breakup {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}
table.breakup th,
table.breakup td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.35rem;
  text-align: left;
  vertical-align: top;
}
table.breakup td:last-child,
table.breakup th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}
table.breakup tr.total td { font-weight: 700; border-bottom: none; }
table.breakup tr.win td { color: var(--ok); font-weight: 700; }
table.breakup .sub { color: var(--faint); font-size: 0.8rem; font-weight: 400; }

.kpi-row {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}
@media (min-width: 560px) {
  .kpi-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .kpi-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.kpi {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
}
.kpi .lbl { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.kpi .val {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}
.kpi.win { border-color: #b7dcc4; background: #f3faf5; }
.kpi.win .val { color: var(--ok); }

.fy-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.disclaimer { font-size: 0.85rem; color: var(--muted); max-width: 68ch; }
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.35rem 0 0.85rem;
}
.radio-row label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  margin: 0;
}
