/* Groupfold. Tokens and rules: design/SYSTEM.md. One accent (green), light theme, Manrope + Instrument Sans (self-hosted, OFL). */
@font-face { font-family: "Manrope"; src: url("fonts/manrope-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --bg: #f6f7f4; --surface: #ffffff; --ink: #15201b; --muted: #51605a; --line: #dde2dd; --line-2: #c9d0ca;
  --accent: #0a6b50; --accent-h: #08573f; --accent-t: #e4f1eb;
  --danger: #b3261e; --danger-t: #fcecea; --warn: #6e4700; --warn-t: #fff3d6;
  --r: 8px; --r-l: 12px; --sh: 0 1px 2px rgba(21, 32, 27, .06);
  --head: "Manrope", ui-sans-serif, system-ui, sans-serif; --body: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--body); overflow-x: hidden; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--head); font-weight: 800; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.08; letter-spacing: -.025em; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-h); }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r); z-index: 20; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* header / footer */
header.site { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 20px/1 var(--head); padding: 8px 0; min-height: 44px; }
.brand img { display: block; border-radius: 7px; }
.brand small { font: 500 13px/1 var(--body); color: var(--muted); }
header nav { display: flex; gap: 4px; }
header nav a { color: var(--muted); text-decoration: none; padding: 10px 12px; min-height: 44px; display: inline-flex; align-items: center; border-radius: var(--r); font-size: 15px; }
header nav a:hover { color: var(--ink); background: var(--bg); }
footer.site { margin-top: 72px; padding: 32px 0 48px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 14px; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 12px; }
footer.site nav a { min-height: 44px; display: inline-flex; align-items: center; }
footer.site .sig { font: 800 15px var(--head); color: var(--ink); margin-top: 16px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 15px/1.2 var(--body); cursor: pointer; text-decoration: none; transition: background .15s ease-out, border-color .15s ease-out, transform .15s ease-out; text-align: center; }
.btn:hover { background: var(--bg); border-color: var(--muted); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; }
.btn.big { min-height: 52px; padding: 14px 24px; font-size: 17px; }
.btn[disabled], .btn.is-disabled { background: #e8ebe7; border-color: #e8ebe7; color: #5f6b65; cursor: not-allowed; transform: none; }
.btn.is-busy { cursor: progress; opacity: .8; }
.filebtn { position: relative; }
.filebtn input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.linkish { background: none; border: 0; padding: 10px 4px; min-height: 44px; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linkish:hover { color: var(--accent-h); }

/* hero */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; gap: 40px; align-items: center; grid-template-columns: minmax(0, 1fr); }
.eyebrow { font: 700 13px/1 var(--head); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 0 0 16px; }
.lede { font-size: 18px; color: var(--muted); max-width: 56ch; margin: 20px 0 0; }
.hero-cta { margin: 28px 0 0; }
.trust { color: var(--muted); font-size: 14px; margin: 14px 0 0; max-width: 56ch; }
.hero-shot { margin: 0; min-width: 0; }
.hero-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh); background: var(--surface); }
.hero-shot figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } .hero { padding: 72px 0 48px; } }

/* panels */
.stack { display: grid; gap: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh); padding: 24px; min-width: 0; }
.panel-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.panel-head p { color: var(--muted); margin: 6px 0 0; font-size: 15px; }
.step-n { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-t); color: var(--accent); display: grid; place-items: center; font: 800 15px var(--head); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.msg { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--r); background: var(--bg); font-size: 14px; }
.msg.err, .err { background: var(--danger-t); color: var(--danger); }
.msg.warn { background: var(--warn-t); color: var(--warn); }
.msg.ok, .ok { color: var(--accent); }
.msg[hidden] { display: none; }

/* drop zone */
.drop { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 28px 16px; border: 2px dashed var(--line-2); border-radius: var(--r-l); background: var(--bg); cursor: pointer; transition: border-color .15s ease-out, background .15s ease-out; }
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-t); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop .ic { width: 28px; height: 28px; color: var(--accent); }
.drop-t { font-size: 17px; }
.drop-s { color: var(--muted); font-size: 14px; }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.examples { margin-top: 12px; }
.group-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 24px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.field { display: grid; gap: 4px; min-width: 0; }
.lbl, label { font-size: 14px; font-weight: 600; }
.field .hint { margin: 0; }

/* inputs */
input[type=text], input[type=email], select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 400 16px/1.3 var(--body); transition: border-color .15s ease-out; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
input[aria-invalid=true], select[aria-invalid=true], input.bad { border-color: var(--danger); background: var(--danger-t); }
input::placeholder { color: #6b7770; }
.cur { display: flex; gap: 8px; }
.cur select { min-width: 150px; }
.cur input { width: 84px; text-transform: uppercase; }
.fmsg { color: var(--danger); font-size: 13px; margin: 4px 0 0; }

/* company cards */
.companies { display: grid; gap: 12px; margin-top: 16px; }
.co { border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; background: var(--surface); min-width: 0; }
.co.is-error { border-color: #e4a6a2; background: var(--danger-t); }
.co-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.co-file { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.co-file b { color: var(--ink); font-weight: 600; }
.co-err { color: var(--danger); font-weight: 600; margin: 0 0 12px; }
.co-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.co-period { grid-column: 1 / -1; font-size: 14px; color: var(--muted); margin: 0; }
.co-period b { color: var(--ink); font-weight: 600; }
.rate-line { display: flex; align-items: center; gap: 8px; }
.rate-line span { white-space: nowrap; font-size: 15px; }
.rate-line input { min-width: 90px; }
.x { flex: none; width: 44px; height: 44px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer; }
.x:hover { background: var(--bg); color: var(--danger); border-color: var(--line); }

/* status */
.status { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--r); font-weight: 600; margin-bottom: 12px; }
.status.ok { background: var(--accent-t); color: #064a37; }
.status.bad { background: var(--danger-t); color: var(--danger); }
.status.wait { background: var(--bg); color: var(--muted); }
.status ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }
.errs { display: grid; gap: 8px; margin: 0 0 12px; }
.errs .msg { margin: 0; }
.errs b { display: block; }

/* tables */
.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table.pl, table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.pl th, table.pl td, table.grid th, table.grid td { padding: 4px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: middle; }
table.pl th:first-child, table.pl td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 190px; max-width: 260px; white-space: normal; border-right: 1px solid var(--line); }
table.pl thead th { background: #f0f3ef; font: 700 13px/1.3 var(--head); vertical-align: bottom; position: sticky; top: 0; }
table.pl thead th:first-child { z-index: 2; background: #f0f3ef; }
table.pl .cur-sub { display: block; font: 500 12px var(--body); color: var(--muted); }
table.pl .co-bad { color: var(--danger); }
table.pl tr.sec td { background: var(--bg); font: 800 13px var(--head); text-transform: none; text-align: left; color: var(--ink); }
table.pl tr.sec td:first-child { background: var(--bg); }
table.pl tr.acc td:first-child { padding-left: 24px; }
table.pl tr.acc td { padding-top: 2px; padding-bottom: 2px; }
table.pl tr.tot td, table.pl tr.res td { font-weight: 800; border-top: 1px solid var(--line-2); }
table.pl tr.res td { background: var(--accent-t); }
table.pl tr.res td:first-child { background: var(--accent-t); }
table.pl tr.acc:hover td, table.pl tr.acc:hover td:first-child { background: #f1f6f3; }
table.pl td.na { color: #6b7770; }
table.pl td.bad { background: var(--danger-t); color: var(--danger); font-weight: 800; }
table.pl td.grp { font-weight: 700; border-left: 1px solid var(--line-2); }
table.pl .elim-in { width: 112px; min-height: 44px; padding: 4px 8px; text-align: right; font-size: 14px; }
table.pl .elim-in.bad { border-color: var(--danger); background: var(--danger-t); }
table.grid th { background: #f0f3ef; font: 700 13px var(--head); }
table.grid td.l, table.grid th.l { text-align: left; white-space: normal; }
table.grid tr.bad td { background: var(--danger-t); color: var(--danger); font-weight: 600; }
.rounding { color: var(--muted); font-size: 13px; }

/* folds */
.fold { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; background: var(--surface); }
.fold > summary { cursor: pointer; font-weight: 700; padding: 12px 0; min-height: 44px; list-style-position: inside; }
.fold[open] > summary { margin-bottom: 8px; }
.fold[open] { padding-bottom: 16px; }
.two { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 8px; align-items: start; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; }
.stack-s { display: grid; gap: 8px; }
#recover-msg.ok { color: var(--accent); }
#recover-msg { margin: 0; font-size: 14px; }

/* mapping */
.map-block { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.map-block:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.map-block h3 { margin-bottom: 6px; }
.map-item { display: grid; gap: 8px 16px; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.map-item:last-child { border-bottom: 0; }
.map-item small { display: block; color: var(--muted); font-size: 13px; }
.map-act { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.map-act .btn { min-height: 44px; }
.signq { display: flex; gap: 8px; flex-wrap: wrap; }
.signq label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; font-weight: 600; }
.signq label:has(input:checked) { border-color: var(--accent); background: var(--accent-t); }
.signq input { width: 18px; height: 18px; accent-color: var(--accent); }
@media (max-width: 640px) { .map-item { grid-template-columns: minmax(0, 1fr); } }

/* pay */
.pay-row { align-items: center; margin-top: 0; }
.why { color: var(--muted); font-size: 15px; flex: 1 1 240px; }
.why.bad { color: var(--danger); font-weight: 600; }
.key-box { margin-top: 20px; padding: 16px; border: 1px solid var(--line-2); border-radius: var(--r-l); background: var(--bg); }
.key-box h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.key-box[hidden] { display: none; }
.key-val { font: 700 19px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); overflow-wrap: anywhere; user-select: all; }
#license-status .ok { display: block; margin-top: 12px; font-weight: 600; }

/* bands */
.band { padding: 56px 0 0; }
.band.alt .wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 32px 24px; }
.band h2 { margin-bottom: 20px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: s; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-t); color: var(--accent); font: 800 14px var(--head); margin-bottom: 12px; }
.steps b { display: block; font: 800 17px var(--head); margin-bottom: 6px; }
.steps span { color: var(--muted); font-size: 15px; }
.nots { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.nots li { padding-left: 20px; position: relative; }
.nots li::before { content: ""; position: absolute; left: 0; top: .6em; width: 8px; height: 2px; background: var(--muted); }
.faq { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: 44px; }
.faq p { color: var(--muted); }
.prose { padding-top: 48px; }
.prose h1 { margin-bottom: 8px; }
.prose h2 { margin: 28px 0 8px; font-size: 20px; }
.prose li { margin-bottom: 8px; }

@media (max-width: 640px) {
  .panel { padding: 16px; }
  .hero { padding: 32px 0 24px; }
  .btn.big { width: 100%; }
  .bar nav { width: 100%; overflow-x: auto; }
  .panel-head { gap: 12px; }
  .co-head { flex-direction: row; }
  .cur select { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Group column stays visible: sticky on the right; hint on narrow screens */
table.pl th:last-child, table.pl td:last-child { position: sticky; right: 0; background: var(--surface); z-index: 1; box-shadow: -1px 0 0 var(--line-2); }
table.pl thead th:last-child { background: #f0f3ef; z-index: 2; }
table.pl tr.sec td:last-child, table.pl tr.sec td[colspan] { position: static; box-shadow: none; }
table.pl tr.res td:last-child { background: var(--accent-t); }
table.pl tr.acc:hover td:last-child { background: #f1f6f3; }
table.pl td.grp { border-left: 0; }
.scroll-hint { display: none; color: var(--muted); font-size: 13px; margin: 8px 0 4px; }
@media (max-width: 640px) {
  .scroll-hint { display: block; }
  table.pl th:first-child, table.pl td:first-child { min-width: 112px; max-width: 124px; padding-left: 8px; padding-right: 8px; }
  table.pl tr.acc td:first-child { padding-left: 14px; }
  table.pl .elim-in { width: 96px; }
}
