/* Build payments: mobile-first, no framework */
:root {
  --bg: #f3f0e8;
  --card: #fffdf9;
  --ink: #1b1a17;
  --ink-2: #3d3a33;
  --muted: #6f6a5f;
  --line: #e2dccd;
  --line-2: #d3cbb8;
  --green: #1d6b46;
  --green-ink: #134a31;
  --green-soft: #e1efe5;
  --deep: #1d4d36;
  --amber: #9a5b07;
  --amber-soft: #f9ecd3;
  --red: #b0261c;
  --red-soft: #f9e2de;
  --blue: #2b4f7e;
  --blue-soft: #e3ebf5;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(40, 32, 12, .04), 0 1px 3px rgba(40, 32, 12, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
body.public, body.report { padding-bottom: 24px; }
a { color: var(--green); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.12rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { font-size: .85em; background: var(--bg); padding: .05em .35em; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { max-width: 920px; margin: 0 auto; padding: 16px 16px 24px; }
.wrap-narrow { max-width: 560px; }

/* ------------------------------------------------ top bar & tabs */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(243, 240, 232, .92); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; flex: 1; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--deep); color: #f3e7c6; font-weight: 800; font-size: 1.1rem;
}
.brand-mark-lg { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 16px; margin: 0 auto 12px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: .98rem; }
.brand-text small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: none; }
.icon-link { color: var(--muted); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; }
.icon-link:hover { background: var(--card); color: var(--ink); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: .66rem; font-weight: 600;
  color: var(--muted); text-decoration: none;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--green); }
.tabbar .tab-add span {
  display: grid; place-items: center; width: 44px; height: 44px; margin-top: -18px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 1.7rem; font-weight: 400; line-height: 1;
  box-shadow: 0 4px 12px rgba(29, 107, 70, .35); border: 3px solid var(--card);
}
.tabbar .tab-add { color: var(--ink-2); }

@media (min-width: 760px) {
  body { padding-bottom: 24px; }
  .tabbar { display: none; }
  .topnav { display: flex; align-items: center; gap: 4px; }
  .topnav a:not(.btn) { padding: 8px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; }
  .topnav a:not(.btn):hover { background: var(--card); }
  .topnav a[aria-current="page"] { background: var(--card); color: var(--green); box-shadow: var(--shadow); }
  .topnav .btn { margin-left: 8px; }
  .hide-mobile { display: inline-flex; }
}
@media (max-width: 759px) { .hide-mobile { display: none; } }

/* ------------------------------------------------ cards & layout */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.card-head a { font-size: .9rem; font-weight: 600; }
.card-bad { border-color: #efbdb6; background: linear-gradient(#fff5f3, var(--card)); }
.card-warn { border-color: #ecd3a3; background: linear-gradient(#fffaf0, var(--card)); }
.center-card { text-align: center; margin-top: 8vh; padding: 28px 20px; }
.center-card form { text-align: left; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; flex: 1 1 100%; }
.page-head .back + h1 { margin-top: 4px; }
.back { font-weight: 600; text-decoration: none; font-size: .92rem; }
.page-links { text-align: center; color: var(--muted); font-size: .88rem; margin: 20px 0 8px; }
.section-title { margin: 26px 2px 4px; }
.section-sub { margin: 0 2px 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.eyebrow { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.empty { text-align: center; padding: 24px 16px; color: var(--muted); }

/* ------------------------------------------------ hero & stats */
.hero {
  background: var(--deep); color: #f6f1e3; border-radius: calc(var(--radius) + 4px); padding: 18px 18px 16px; margin-bottom: 12px;
  background-image: radial-gradient(120% 140% at 100% 0%, rgba(243, 231, 198, .14), transparent 55%);
}
.hero .eyebrow { color: rgba(246, 241, 227, .72); }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero-link { color: #f3e7c6; font-size: .86rem; font-weight: 600; text-decoration: none; }
.hero-amount { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 12px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-amount span { font-size: 1rem; font-weight: 500; letter-spacing: 0; color: rgba(246, 241, 227, .75); }
.hero-foot { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; color: rgba(246, 241, 227, .8); margin-top: 10px; flex-wrap: wrap; }
.hero-left strong { color: #fff; font-size: 1.05rem; }
.hero progress { --track: rgba(255, 255, 255, .16); --fill: #e9d9a6; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); min-width: 0;
}
.stat-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-value-sm { font-size: 1.05rem; }
.stat-sub { font-size: .76rem; color: var(--muted); }
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:first-child { grid-column: 1 / -1; }
}
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 12px; }
.summary-grid > * { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }

progress {
  --track: #ebe5d7; --fill: var(--green);
  appearance: none; -webkit-appearance: none; width: 100%; height: 10px; border: 0; border-radius: 99px; background: var(--track); overflow: hidden; display: block;
}
progress::-webkit-progress-bar { background: var(--track); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--fill); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--fill); border-radius: 99px; }
.meter { margin: 4px 0 8px; }

/* ------------------------------------------------ lists */
.list { display: flex; flex-direction: column; }
.card.list { padding: 4px 16px; }
.row {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.row:last-child { border-bottom: 0; }
.row:hover .row-title { color: var(--green); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-meta { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.row-amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.row-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.list-summary { display: flex; justify-content: space-between; padding: 0 4px 8px; color: var(--muted); font-size: .9rem; }
.list-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-size: .7rem; font-weight: 700;
  white-space: nowrap; background: var(--bg); color: var(--ink-2); line-height: 1.5;
}
.b-contract, .pay-paid, .work-complete, .var-done { background: var(--green-soft); color: var(--green-ink); }
.b-out, .var-agreed { background: var(--blue-soft); color: var(--blue); }
.b-signed { background: var(--green); color: #fff; }
.b-pending, .pay-part, .work-in_progress, .var-proposed { background: var(--amber-soft); color: var(--amber); }
.b-unsigned, .pay-over { background: var(--red-soft); color: var(--red); }
.inv-paid { background: var(--green-soft); color: var(--green-ink); }
.inv-part { background: var(--amber-soft); color: var(--amber); }
.inv-over { background: var(--red-soft); color: var(--red); }
.pay-unpaid, .work-not_started, .var-cancelled, .inv-unpaid { background: #efebe1; color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { padding: 10px 12px; border-radius: 10px; font-size: .92rem; }
.check-bad { background: var(--red-soft); }
.check-warn { background: var(--amber-soft); }
.next-stage { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.next-stage h2 { margin: 4px 0; }
.next-stage p { margin: 0; }

/* ------------------------------------------------ alerts */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: .93rem; border: 1px solid transparent; }
.alert-ok { background: var(--green-soft); color: var(--green-ink); border-color: #c3dfcc; }
.alert-warn { background: var(--amber-soft); color: #6d4105; border-color: #eed49f; }
.alert-error { background: var(--red-soft); color: #7e1a13; border-color: #efbdb6; }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px;
  border-radius: 11px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 600 .95rem/1.2 var(--font);
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .05s;
}
.btn:hover { background: #f6f2e9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: #185c3c; }
.btn-whatsapp { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn-whatsapp:hover { background: #198447; }
.btn-quiet-danger { background: transparent; border-color: transparent; color: var(--red); }
.btn-quiet-danger:hover { background: var(--red-soft); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 12px 22px; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.actions form { margin: 0; }
.inline-form { margin-top: 8px; }
.locked { font-size: .88rem; color: var(--muted); }

/* ------------------------------------------------ forms */
.form h2 { margin-top: 8px; }
.form h2 + .form-row, .form > h2 ~ h2 { margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-weight: 650; font-size: .92rem; color: var(--ink-2); padding: 0; }
.field label small, .field legend small { font-weight: 400; color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; gap: 10px; }
.field-inline select { width: auto; }
.field-end { justify-content: flex-end; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 560px) { .form-row { grid-template-columns: 1fr 1fr; } }
input, select, textarea {
  width: 100%; font: 16px/1.4 var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line-2);
  border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input[type="file"] { padding: 8px; font-size: .9rem; background: var(--bg); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); flex: none; margin: 2px 0 0; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(29, 107, 70, .22); border-color: var(--green); }
textarea { resize: vertical; }
.has-error input, .has-error select, .has-error textarea, .has-error .money-input { border-color: var(--red); }
.field-error { color: var(--red); font-size: .85rem; margin: 0; }
.hint { font-size: .85rem; margin: 0; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .93rem; cursor: pointer; font-weight: 400 !important; }
.check small { color: var(--muted); }
.check-inline { align-items: center; white-space: nowrap; }
.check-confirm { padding: 12px; border-radius: 10px; background: var(--bg); margin-bottom: 14px; }

.money-input { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; padding-left: 14px; }
.money-input:focus-within { outline: 3px solid rgba(29, 107, 70, .22); border-color: var(--green); }
.money-input span { font-size: 1.5rem; font-weight: 700; color: var(--muted); }
.money-input input { border: 0; outline: 0; font-size: 1.6rem; font-weight: 800; padding: 8px 10px; font-variant-numeric: tabular-nums; background: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input, .choice input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 8px 16px; border-radius: 99px; border: 1px solid var(--line-2);
  background: #fff; font-weight: 600; font-size: .93rem; cursor: pointer;
}
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:focus-visible + span, .choice input:focus-visible + .choice-body { outline: 3px solid rgba(29, 107, 70, .35); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-grid .choice-contract { grid-column: 1 / -1; }
@media (min-width: 640px) { .choice-grid { grid-template-columns: repeat(4, 1fr); } }
.choice { position: relative; display: flex; }
.choice-body {
  display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: #fff; cursor: pointer; line-height: 1.3;
}
.choice-body strong { font-size: .95rem; }
.choice-body small { color: var(--muted); font-size: .78rem; }
.choice-tag { font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.choice-contract input:checked + .choice-body { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }
.choice-contract input:checked + .choice-body .choice-tag { color: var(--green); }
.choice-out input:checked + .choice-body { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.choice-out input:checked + .choice-body .choice-tag { color: var(--blue); }
.form-actions { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); padding-top: 8px; }
.form-actions .btn { width: 100%; box-shadow: 0 6px 18px rgba(29, 107, 70, .25); }
@media (min-width: 760px) { .form-actions { position: static; } .form-actions .btn { width: auto; box-shadow: none; } }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters input[type="search"] { flex: 1 1 100%; }
.filters select { flex: 1 1 140px; width: auto; }
@media (min-width: 760px) { .filters input[type="search"] { flex: 1 1 200px; } }

/* ------------------------------------------------ payment detail */
.pay-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pay-amount { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pay-title { font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 16px 0 0; }
.details > div { min-width: 0; }
.details .wide { grid-column: 1 / -1; }
.details dt { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.details dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.signed { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.signed-info { flex: 1 1 200px; }
.signed-name { font-size: 1.2rem; font-weight: 700; margin: 8px 0 2px; }
.signed-media { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.sig-img { max-width: 240px; max-height: 110px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.handover-img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.linkbox { display: flex; gap: 8px; margin: 10px 0 0; }
.linkbox input { font-size: .85rem; background: var(--bg); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 12px; }
.thumb { position: relative; margin: 0; aspect-ratio: 1; }
.thumb a { display: block; width: 100%; height: 100%; }
.thumb img, .file-icon { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; background: var(--bg); font-weight: 800; color: var(--muted); }
.thumb form { position: absolute; top: 4px; right: 4px; margin: 0; }
.thumb-del { width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(27, 26, 23, .7); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
.upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-row input { flex: 1 1 200px; }
.history summary { cursor: pointer; font-weight: 650; }
.history ul { margin: 10px 0 0; padding-left: 18px; font-size: .88rem; }
.history li { margin-bottom: 4px; }

/* ------------------------------------------------ invoices */
.invoice-progress { margin-top: 14px; }
.invoice-foot { color: var(--muted); margin-top: 6px; }
.invoice-foot strong { color: var(--ink); }
.part { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 0; margin: 0 0 10px; }
.part-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 4px; }
.part-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (min-width: 640px) { .part-grid { grid-template-columns: 1fr 1fr 1fr 1.4fr; } }
.part-grid .field { margin-bottom: 10px; }
.parts-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; background: var(--bg); color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 600; }

/* ------------------------------------------------ stages */
.stages { display: flex; flex-direction: column; }
.stage { padding: 0; overflow: hidden; }
.stage > summary, details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card:not(.stage):not(.variation) > summary { font-weight: 650; }
.stage > summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.stage-num {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--bg); font-weight: 800; font-size: .9rem; color: var(--ink-2);
}
.stage-paid .stage-num, .stage-over .stage-num { background: var(--green); color: #fff; }
.stage-part .stage-num { background: var(--amber-soft); color: var(--amber); }
.stage-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.stage-name { font-weight: 650; line-height: 1.25; }
.stage-badges { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.stage-money { display: flex; flex-direction: column; align-items: flex-end; width: 92px; flex: none; font-variant-numeric: tabular-nums; }
.stage-money small { color: var(--muted); font-size: .74rem; margin-bottom: 4px; }
.stage-money progress { height: 6px; }
.stage-body { padding: 0 16px 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.variation > summary { display: flex; align-items: center; gap: 12px; }
.variation .stage-body { margin: 12px -16px -16px; }
.is-muted { opacity: .6; }
.mini-list { list-style: none; padding: 0; margin: 0 0 12px; }
.mini-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.stage-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
details.subtle { margin-bottom: 12px; }
details.subtle summary { cursor: pointer; color: var(--muted); font-size: .88rem; margin-bottom: 8px; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-group td { font-weight: 700; background: var(--bg); font-size: .8rem; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--ink); }
.table-small { font-size: .82rem; }

/* ------------------------------------------------ signing page */
.sign-head { text-align: center; margin: 12px 0 16px; }
.sign-head h1 { margin: 6px 0 4px; }
.receipt-card { text-align: center; }
.receipt-card .details { text-align: left; border-top: 1px solid var(--line); padding-top: 14px; }
.receipt-amount { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 0; line-height: 1.1; }
.receipt-method { color: var(--muted); margin-top: 4px; }
.balance-card h2 small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.balance { margin: 0; }
.balance div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.balance dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance-total { font-size: 1.1rem; }
.balance-total dd { color: var(--green); }
.balance-stage { font-size: .88rem; color: var(--muted); border-bottom: 0 !important; }
.declaration { background: var(--bg); border-left: 4px solid var(--green); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.declaration p { margin: 6px 0 0; font-size: 1rem; }

.sigpad { position: relative; height: 210px; border: 2px dashed var(--line-2); border-radius: 12px; background: #fff; touch-action: none; overflow: hidden; }
.sigpad.has-ink { border-style: solid; border-color: var(--green); }
.sigpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; z-index: 1; }
.sigpad-line { position: absolute; left: 20px; right: 20px; bottom: 48px; border-bottom: 1px solid var(--line-2); }
.sigpad-line::before { content: "✕"; position: absolute; left: 0; bottom: 4px; color: var(--line-2); font-size: .9rem; }
.sigpad-clear { position: absolute; right: 8px; top: 8px; z-index: 2; }
.photo-preview { max-width: 160px; border-radius: 10px; border: 1px solid var(--line); }

.done { margin-top: 4vh; }
.done-mark { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 2rem; }
.done .stack { margin: 18px 0 10px; }

/* ------------------------------------------------ report / print */
.report-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.report-head { border-bottom: 3px solid var(--deep); padding-bottom: 12px; margin-bottom: 16px; }
.report-head p { margin: 2px 0; }
.report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.report-summary div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--card); }
.report-summary span { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.report-summary strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.report h2 { margin-top: 24px; }
.report .table { background: var(--card); }
.report main { overflow-x: auto; }
@media print {
  body { background: #fff; font-size: 11px; padding: 0; }
  .no-print, .topbar, .tabbar { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .report-summary div, .report .table { background: #fff; }
  .table tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
