:root {
  --bg: #f1ebdf;
  --paper: #fbf8f2;
  --ink: #261d14;
  --muted: #574837;
  --line: #d3c4aa;
  --rule: #b9a585;
  --accent: #2c6431;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9d6;
  --bad: #9a3412;
  --focus: #b45309;
  --head: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1712;
    --paper: #251f18;
    --ink: #f0e7d8;
    --muted: #cdbda5;
    --line: #4b3f31;
    --rule: #6b5a45;
    --accent: #93d28c;
    --accent-ink: #10230f;
    --accent-soft: #263a24;
    --bad: #f5a27d;
    --focus: #f6b55a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body); }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; font-stretch: condensed; }

.top { padding: 22px 0 10px; }
.top h1 { font-size: clamp(1.75rem, 4.5vw, 2.6rem); margin: 0 0 6px; letter-spacing: -0.01em; }
.lede { margin: 0; max-width: 64ch; color: var(--muted); }

.tool { padding-bottom: 24px; }
label { display: block; }
input[type="text"], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 4px; padding: 9px 10px; min-height: 44px; width: 100%;
}
textarea { min-height: 7em; resize: vertical; font-family: var(--body); }
input[aria-invalid="true"] { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }

.btn {
  font: inherit; font-size: 16px; font-weight: 600; min-height: 44px; padding: 8px 16px; border-radius: 4px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 16px; }
.btn.quiet { background: transparent; }
.btn.icon { width: 44px; padding: 0; font-size: 18px; }
.btn[hidden] { display: none; }

.details { display: grid; grid-template-columns: 1fr 7rem; gap: 10px 14px; align-items: end; padding: 14px 0 6px; }
.details .more { grid-column: 1 / -1; }
.more summary, .paste summary, .kept summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker, .paste summary::-webkit-details-marker, .kept summary::-webkit-details-marker { display: none; }
.more summary::before, .paste summary::before, .kept summary::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 7px; border-color: transparent transparent transparent currentColor; transition: transform .15s; }
.more[open] > summary::before, .paste[open] > summary::before, .kept[open] > summary::before { transform: rotate(90deg); }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 4px 0 8px; }

.tabs { display: grid; grid-template-columns: repeat(4, auto) 1fr; gap: 0; border-bottom: 2px solid var(--ink); margin-top: 8px; }
.tabs [role="tab"] {
  font: inherit; font-family: var(--head); font-size: 1.15rem; font-weight: 700; color: var(--muted); background: none;
  border: 0; border-bottom: 4px solid transparent; margin-bottom: -2px; padding: 10px 16px 8px; min-height: 48px; cursor: pointer;
  white-space: nowrap;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.panel { padding: 16px 0 8px; container-type: inline-size; }
.empty { color: var(--muted); margin: 6px 0 12px; }
.row-btns { margin: 12px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.bad { color: var(--bad); }

/* price list */
.lab { display: block; font-size: 15px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.items, .members, .lines, .mrows, .splits, .kept-list { list-style: none; margin: 0; padding: 0; }
.it-head { display: none; }
.item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.it-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-items: end; }
.it-split { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }
.it-split input { width: 22px; height: 22px; accent-color: var(--accent); }
.it-grid .x { justify-self: end; }
.money-in { display: flex; align-items: center; gap: 6px; }
.money-in .sym { font-weight: 600; color: var(--muted); }
.it-msg { margin: 6px 0 0; color: var(--muted); font-size: 16px; }
.it-msg.bad { color: var(--bad); }
@container (min-width: 760px) {
  .it-head, .it-grid { display: grid; grid-template-columns: 1.3fr 1.2fr 1fr 7.5rem 7.5rem 44px; gap: 10px; }
  .it-head { font-weight: 600; color: var(--muted); font-size: 15px; padding-bottom: 4px; border-bottom: 1px solid var(--rule); }
  .item .lab { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .it-grid { align-items: center; }
}

/* orders */
.mem { border-bottom: 1px solid var(--line); padding: 10px 0; }
.mem.open { background: var(--paper); margin: 4px 0 8px; padding: 10px; border-radius: 4px; border: 1px solid var(--line); }
.m-head { display: grid; gap: 8px 10px; align-items: end; }
.m-tot { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; align-self: end; line-height: 44px; }
.m-head .m-open, .m-head .x { justify-self: start; }
.m-head { grid-template-columns: minmax(0, 5rem) minmax(0, 1fr) auto auto; grid-template-areas: "name name name name" "plot tot open x"; }
.m-head > * { min-width: 0; }
@media (max-width: 400px) { .mem.open { padding: 8px 6px; } .m-head { gap: 8px 6px; } }
.m-name { grid-area: name; } .m-plot { grid-area: plot; } .m-tot { grid-area: tot; justify-self: end; } .m-open { grid-area: open; } .m-head .x { grid-area: x; }
@container (min-width: 700px) {
  .m-head { grid-template-columns: 1fr 6rem 7rem auto 44px; grid-template-areas: "name plot tot open x"; }
}
.lines { margin-top: 10px; border-top: 1px dashed var(--rule); }
.line { display: grid; grid-template-columns: 1fr; gap: 4px 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.l-name { font-weight: 600; }
.l-pack { display: block; font-weight: 400; color: var(--muted); font-size: 16px; }
.l-in { display: grid; grid-template-columns: 6rem minmax(0, 8rem); gap: 8px; align-items: center; }
.by-one { color: var(--muted); }
.l-out { font-variant-numeric: tabular-nums; min-height: 1.5em; }
.l-out .amt { font-weight: 700; margin-left: 6px; }
.l-out .why { display: block; color: var(--muted); font-size: 16px; }
@container (min-width: 700px) {
  .line { grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr); align-items: center; }
}

/* supplier */
.answer { font-size: 1.3rem; margin: 0 0 4px; }
.answer b { font-variant-numeric: tabular-nums; }
.sub { margin: 0 0 14px; color: var(--muted); }
table.sup { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sup th, .sup td { text-align: left; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.sup thead th { border-bottom: 2px solid var(--ink); font-size: 15px; color: var(--muted); }
.sup tfoot th, .sup tfoot td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 700; }
.sup .num { text-align: right; }
.sup tbody th { font-weight: 600; }
.cell-sub { display: block; font-weight: 400; color: var(--muted); font-size: 16px; }
.sup .packs input { width: 5rem; text-align: right; }
.sup .packs .cell-sub { font-size: 15px; }
@container (max-width: 520px) {
  .sup thead { display: none; }
  .sup tbody tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .sup tbody th { grid-column: 1 / -1; }
  .sup tbody th, .sup tbody td { border: 0; padding: 0; }
  .sup tbody td::before { content: attr(data-l); display: block; font-size: 15px; color: var(--muted); font-weight: 600; }
  .sup tbody .num { text-align: left; }
  .sup .packs input { text-align: left; }
  .sup tfoot tr { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; border-top: 2px solid var(--ink); padding-top: 6px; }
  .sup tfoot th, .sup tfoot td { border-top: 0; padding: 0; }
  .sup tfoot td:empty { display: none; }
}
.panel h3 { font-size: 1.25rem; margin: 22px 0 6px; }
.splits li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.seg-wrap { border: 0; padding: 0; margin: 16px 0 0; }
.seg-wrap legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; max-width: 100%; }
.seg label { flex: 1 1 auto; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; min-height: 44px; padding: 8px 14px; background: var(--paper); justify-content: center; height: 100%; font-weight: 600; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.charge { margin-top: 18px; }
.f-charge { font-weight: 600; }
.f-charge .money-in { margin-top: 4px; max-width: 12rem; font-weight: 400; }
.m-charge { margin: 8px 0 0; color: var(--muted); }

/* money */
.mrow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mr-name { grid-column: 1 / -1; font-weight: 700; }
.mr-owes .lab { display: inline; }
.mr-paid { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.mr-paid .lab { margin: 0; }
.mr-left.due { font-weight: 700; }
.mrow .btn { justify-self: start; }
@container (min-width: 700px) {
  .mrow { grid-template-columns: minmax(0, 1.5fr) 8rem 12rem minmax(0, 1fr) auto; }
  .mr-name { grid-column: auto; }
}

.issues ul { margin: 6px 0 0; padding: 10px 14px 10px 30px; border: 1px solid var(--bad); border-radius: 4px; color: var(--bad); }
.report ul { margin: 6px 0; padding-left: 20px; }
.report q { overflow-wrap: anywhere; }

.out { border-top: 2px solid var(--ink); margin-top: 24px; padding-top: 6px; }
.out h2 { font-size: 1.5rem; margin: 10px 0 0; }
.seg4 span { padding: 8px 12px; }
.out-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; }
.dl-label { width: 100%; font-weight: 600; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.bar { border: 2px solid var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 10px 14px; margin: 14px 0 0; }
.bar p { margin: 0; }
.bar-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px !important; }
.note { border-left: 0; background: var(--paper); border: 1px solid var(--bad); color: var(--ink); padding: 10px 14px; border-radius: 4px; }

.kept { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 4px; }
.kept-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kept-list .when { color: var(--muted); }
.kept-act { display: flex; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 32px));
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 4px; display: flex; gap: 12px;
  align-items: center; justify-content: space-between; z-index: 20; pointer-events: none;
}
.toast[hidden] { display: none; }
.toast .btn { pointer-events: auto; background: var(--bg); color: var(--ink); border-color: var(--bg); }

.prose { max-width: 760px; padding-top: 12px; padding-bottom: 32px; }
.prose h2 { font-size: 1.6rem; margin: 28px 0 8px; }
.prose h3 { font-size: 1.2rem; margin: 20px 0 4px; }
.prose p { margin: 0 0 12px; }

.site-foot { border-top: 2px solid var(--ink); padding: 18px 0 32px; color: var(--muted); }
.sb-footer p { margin: 0 0 10px; font-size: 16px; }
.sb-footer a { color: var(--ink); }
.sb-more { line-height: 1.8; }

.print-root { display: none; }

@media (max-width: 560px) {
  .tabs { grid-template-columns: 1fr 1fr; }
  .tabs [role="tab"] { padding: 10px 6px 8px; font-size: 1.05rem; }
  .more-grid { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr 6rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- print ---------- */
@page { margin: 14mm 13mm; }
@media print {
  :root { --ink: #000; --muted: #333; color-scheme: light; }
  body { background: #fff; color: #000; font: 10.5pt/1.35 var(--body); }
  body > *:not(#print) { display: none !important; }
  .print-root { display: block !important; }
  .ph { border-bottom: 1.5pt solid #000; margin-bottom: 8pt; padding-bottom: 4pt; }
  .print-root .ph h2 { font-size: 18pt; margin: 0; }
  .ph p { margin: 1pt 0 0; font-size: 10.5pt; }
  .ph-date { color: #333; }
  .pt { width: calc(100% - 2px); margin: 0 1px; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
  .pt th, .pt td { border: 0.75pt solid #000; padding: 3pt 5pt; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; hyphens: manual; }
  .pt td:nth-child(3) { overflow-wrap: break-word; }
  .nw { white-space: nowrap; }
  .pt thead th { background: none; font-weight: 700; }
  .pt .num { text-align: right; }
  .pt tr { break-inside: avoid; }
  .pt thead { display: table-header-group; }
  .pt tfoot { display: table-row-group; }
  .pt tr.blank td, .pt tr.blank th { height: 20pt; }
  .pt tfoot th, .pt tfoot td { font-weight: 700; }
  .c-item { width: 26%; } .c-var { width: 20%; } .c-pack { width: 18%; } .c-n { width: 9%; } .c-m { width: 13.5%; }
  .pnote { margin: 8pt 0 0; }
  .slip { border-top: 1pt dashed #000; padding: 5pt 0 7pt; break-inside: avoid; }
  .slip h3 { font-size: 13pt; margin: 0 0 3pt; }
  .slip-t th, .slip-t td, .chk td { padding: 1.5pt 5pt; line-height: 1.25; font-size: 10pt; }
  .slip h3 span { font-size: 11pt; font-weight: 400; margin-left: 10pt; }
  .slip-t .c-item { width: 45%; } .slip-t .c-get { width: 37%; } .slip-t .c-m { width: 18%; }
  .slip-tot { margin: 3pt 0 0; font-size: 11pt; }
  .slip-note { margin: 2pt 0 0; font-size: 10pt; }
  .check h2 { font-size: 13pt; margin: 10pt 0 4pt; break-after: avoid; }
  .split-block { break-inside: avoid; margin-bottom: 6pt; }
  .split-block h3 { font-size: 11pt; margin: 0 0 2pt; font-family: var(--body); }
  .ticks { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 16pt; }
  .ticks li { padding: 1pt 0; break-inside: avoid; }
  .tick { display: inline-block; width: 10pt; height: 10pt; border: 1pt solid #000; vertical-align: -1pt; margin-right: 6pt; }
  .chk .c-name { width: 20%; } .chk .c-plot { width: 8%; } .chk .c-what { width: 42%; } .chk .c-tk { width: 10%; }
  .chk th.tk { font-size: 9.5pt; padding: 3pt 2pt; overflow-wrap: normal; }
  .chk .tk { text-align: center; } .chk td.tk .tick { margin: 0; }
  .mon .c-name { width: 27%; } .mon .c-plot { width: 9%; } .mon .c-m { width: 14%; } .mon .c-day { width: 22%; }
  .mon tbody td { height: 18pt; }
}
