:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1d1f22;
  --muted: #5b5f66;
  --line: #e2dfd6;
  --accent: #0f6e5c;
  --accent-ink: #ffffff;
  --accent-soft: #e4f1ec;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn: #855700;
  --warn-soft: #fff3d6;
  --ok: #146c43;
  --ok-soft: #e1f3e8;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
code { font: 0.92em ui-monospace, SFMono-Regular, Consolas, monospace; background: #eeebe3; padding: 1px 5px; border-radius: 4px; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.top { border-bottom: 1px solid var(--line); background: var(--card); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; min-height: 44px; }
.brand small { font-weight: 500; color: var(--muted); }
.top nav { display: flex; gap: 4px 18px; font-size: 15px; flex-wrap: wrap; }
.top nav a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 36px; }
.top nav a:hover { color: var(--ink); }

.hero { padding: 48px 16px 26px; }
h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.13; margin: 0 0 14px; letter-spacing: -0.01em; max-width: 21ch; }
.lead { font-size: 18px; color: #33363a; max-width: 62ch; margin: 0 0 12px; }
.hero-note { color: var(--muted); margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 40px; }
.step { margin-bottom: 26px; }
.step:last-child { margin-bottom: 0; }
h2.step-h, h3 { font-size: 18px; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 700; flex: none; }
.lbl { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 15px; }
input[type="text"], input[type="date"], input[type="number"], input:not([type]), select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #c8c5bb; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; max-width: 460px; min-height: 44px; }
textarea { max-width: 100%; min-height: 120px; resize: vertical; font-size: 15px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, .drop:focus-within, .pick:focus-within { outline: 3px solid #7bc4b3; outline-offset: 2px; }
.hint { color: var(--muted); font-size: 14.5px; margin: 8px 0 0; max-width: 72ch; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { font: inherit; font-size: 15px; border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 99px; cursor: pointer; color: var(--ink); min-height: 44px; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.drop { display: block; border: 2px dashed #c3c0b5; border-radius: var(--radius); padding: 22px 16px; text-align: center; cursor: pointer; background: #fbfaf7; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#file-name { font-weight: 600; overflow-wrap: anywhere; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 8px; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.quiet { background: #fff; color: var(--ink); border-color: #c8c5bb; }
.btn.danger { background: #fff; color: var(--bad); border-color: #e5b4ae; }
.btn.small { padding: 6px 12px; min-height: 40px; font-size: 14.5px; }
.btn:disabled { background: #e8e6df; border-color: #d8d5cc; color: #6c6e72; cursor: not-allowed; }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 32px; }
.msg { color: var(--bad); font-weight: 600; margin: 12px 0 0; }
.msg:empty { display: none; }
.ok-msg { color: var(--ok); font-weight: 600; margin: 12px 0 0; }
.ok-msg:empty { display: none; }

/* column mapper */
.map { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; margin-top: 8px; }
.map label { display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; font-weight: 600; min-width: 0; }
.map select { max-width: 100%; padding: 8px 10px; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf9f5; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.amt, th.amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }

/* filters and pick list */
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; font-weight: 600; }
.filters input[type="date"], .filters input[type="number"] { width: 170px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--accent); }
.picklist { margin-top: 12px; }
.pick { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fff; cursor: pointer; }
.pick.on { border-color: var(--accent); background: #f4faf8; }
.pick input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.pick .v { font-weight: 600; overflow-wrap: anywhere; }
.pick .a { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pick .d { grid-column: 2 / 4; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.count-line { font-weight: 600; margin: 12px 0 0; }

.linkbox { margin-top: 16px; padding: 16px; border-radius: var(--radius); background: var(--accent-soft); }
.linkbox p { margin: 0 0 10px; }
.linkbox input { max-width: 100%; font-size: 14px; }
.warnbox { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: #4d3600; font-size: 15px; }
.warnbox p { margin: 0 0 8px; }
.warnbox p:last-child { margin: 0; }

/* dashboard */
.reqs { display: grid; gap: 12px; }
.req { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; }
.req-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; align-items: baseline; }
.req-h b { font-size: 17px; overflow-wrap: anywhere; }
.bar { height: 8px; background: #ecebe5; border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }
.chip { display: inline-block; font-size: 13.5px; font-weight: 600; padding: 1px 9px; border-radius: 99px; white-space: nowrap; }
.chip.received { background: var(--ok-soft); color: var(--ok); }
.chip.none { background: #ecebe5; color: #45484d; }
.chip.open { background: var(--warn-soft); color: var(--warn); }
.items { margin-top: 12px; }
.items td .hint { margin: 2px 0 0; font-size: 13px; }

.prose { margin-bottom: 40px; }
.prose h2 { font-size: 24px; margin: 0 0 12px; }
.prose p, .prose li { max-width: 70ch; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0; list-style: none; counter-reset: how; }
.how li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; counter-increment: how; }
.how li::before { content: counter(how); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.how b { display: block; margin-bottom: 4px; }
.plans { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.plan.main { border-color: var(--accent); }
.plan h3 { margin-bottom: 4px; }
.price { font-size: 30px; font-weight: 700; margin: 0 0 6px; }
.price small { font-size: 15px; font-weight: 500; color: var(--muted); }
.plan ul { padding-left: 18px; margin: 8px 0 14px; }
.key-box { margin-top: 12px; }
.license { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.license label { font-weight: 600; font-size: 15px; width: 100%; }
.license input { flex: 1 1 200px; max-width: 320px; }
.notify { display: inline-flex; align-items: center; min-height: 44px; margin-left: 12px; font-size: 15px; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; min-height: 32px; display: list-item; padding: 4px 0; }
details p { margin: 8px 0 4px; color: #33363a; }

.foot { border-top: 1px solid var(--line); background: var(--card); padding: 22px 0 30px; font-size: 14.5px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 8px; }
.foot nav a, .foot p a { display: inline-flex; align-items: center; min-height: 32px; }
.foot p { margin: 4px 0; }

/* client page */
.c-head { padding: 26px 16px 8px; }
.c-head h1 { font-size: clamp(24px, 6vw, 34px); max-width: none; }
.c-note { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; margin: 12px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-progress { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 10px 0 6px; }
.c-progress p { margin: 0; font-weight: 600; }
.c-list { list-style: none; padding: 0; margin: 8px 0 24px; display: grid; gap: 12px; }
.c-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.c-item.received { border-color: #9fd3b8; }
.c-item.none { border-color: #d0cec6; }
.c-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.c-top .v { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.c-top .a { font-weight: 700; font-size: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-meta { color: var(--muted); font-size: 14.5px; margin: 2px 0 10px; overflow-wrap: anywhere; }
.c-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.c-actions .btn { width: 100%; padding: 10px 8px; }
.c-actions .wide { grid-column: 1 / -1; }
.c-file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.c-files { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.c-files li { display: flex; justify-content: space-between; gap: 8px; align-items: center; background: var(--ok-soft); border-radius: 8px; padding: 4px 4px 4px 10px; font-size: 14.5px; overflow-wrap: anywhere; }
.c-files .link { padding: 0 10px; min-height: 40px; color: var(--bad); text-decoration: none; font-weight: 600; }
.c-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.c-none { margin-top: 10px; }
.c-none textarea { min-height: 70px; }
.up { margin-top: 10px; }
.up .bar { margin: 0 0 4px; }
.up p { margin: 0; font-size: 14px; color: var(--muted); }
.done-box { background: var(--ok-soft); color: #0f4e31; border-radius: var(--radius); padding: 14px 16px; font-weight: 600; margin-bottom: 24px; }

@media (max-width: 720px) {
  .how { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero { padding-top: 30px; }
  .card { padding: 18px 14px; }
  .top nav { gap: 2px 14px; font-size: 14px; }
  .actions .btn { flex: 1 1 100%; }
  .filters label { flex: 1 1 140px; }
  .filters input[type="date"], .filters input[type="number"] { width: 100%; }
  .notify { margin-left: 0; }
}

/* Grid and flex children must not grow past the screen: wide tables scroll inside .scroll. */
.reqs { grid-template-columns: minmax(0, 1fr); }
.req, .items, .scroll, .step, .c-item { min-width: 0; max-width: 100%; }
.card { min-width: 0; margin: 0 auto 40px; }
.filters label.check { flex-direction: row; align-items: center; font-weight: 500; }
@media (max-width: 640px) {
  .prose .hint a, .step .hint a, .prose p a { display: inline-flex; align-items: center; min-height: 32px; }
}
