/* Errand: agent page (docket + dispatch form), reviews, run page (desk), join (courier pass), builder (clipboard), how (itemised receipt), 404.
   Builder B owns this file. Tokens and components (.btn, .ticket, .slip, .stamp, .field...) live in styles.css. */
.btn.jump-run { display: none; margin: 18px 0 0; justify-content: space-between; background: var(--stamp); border-color: var(--stamp-ink); box-shadow: 0 3px 0 var(--stamp-ink); }
.prose { color: var(--ink-2); max-width: 40rem; }
.prose p { text-wrap: pretty; }
.sr-only-sm { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ agent page ============ */
/* The docket: a big two-part ticket in the agent's category colour. */
.docket {
  --cat: var(--c-research);
  position: relative; display: grid; grid-template-columns: 172px minmax(0, 1fr); min-height: 232px; margin: 4px 0 26px;
  filter: drop-shadow(0 1px 0 rgba(21, 32, 28, 0.08)) drop-shadow(0 14px 18px rgba(21, 32, 28, 0.13));
}
.docket-stub {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 10px; padding: 28px 12px 24px;
  background: var(--cat); color: #fff; border-radius: 14px 0 0 14px;
  -webkit-mask: radial-gradient(circle at 100% 0, transparent 13px, #000 13.5px) top / 100% 51% no-repeat, radial-gradient(circle at 100% 100%, transparent 13px, #000 13.5px) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle at 100% 0, transparent 13px, #000 13.5px) top / 100% 51% no-repeat, radial-gradient(circle at 100% 100%, transparent 13px, #000 13.5px) bottom / 100% 51% no-repeat;
}
.docket-stub::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 8px); pointer-events: none; }
.docket-glyph { width: 46px; height: 46px; }
.docket-price { font: 500 3.1rem/1 var(--mono); text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.docket-price small { display: block; margin-top: 8px; font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.85; letter-spacing: 0.14em; }
.docket-cat { font: 500 0.64rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.14em; text-align: center; opacity: 0.95; }
.docket-body {
  position: relative; min-width: 0; padding: 28px 34px 28px 38px; background: var(--card); border-radius: 0 14px 14px 0;
  -webkit-mask: radial-gradient(circle at 0 0, transparent 13px, #000 13.5px) top / 100% 51% no-repeat, radial-gradient(circle at 0 100%, transparent 13px, #000 13.5px) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle at 0 0, transparent 13px, #000 13.5px) top / 100% 51% no-repeat, radial-gradient(circle at 0 100%, transparent 13px, #000 13.5px) bottom / 100% 51% no-repeat;
}
.docket-body::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; border-left: 2px dashed var(--line); }
.docket-serial { position: absolute; right: 24px; top: 22px; font: 500 0.68rem var(--mono); letter-spacing: 0.14em; color: var(--muted); }
.docket h1 { font-size: clamp(2.1rem, 5.4vw, 3.5rem); overflow-wrap: anywhere; padding-right: 0; }
.docket .back { color: var(--cat); font-weight: 500; }
.docket .back:hover { color: var(--stamp-ink); }
.docket .lede { margin: 12px 0 0; }
.agent-by { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; flex-wrap: wrap; }
.by { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 40px; }
.by > span:last-child { font-weight: 700; color: var(--stamp-ink); }
.by small { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.by:hover strong, .by:hover > span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.docket-bars { position: absolute; right: 30px; bottom: 24px; width: 132px; height: 28px; opacity: 0.7;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 6px, transparent 6px 9px, var(--ink) 9px 12px, transparent 12px 14px, var(--ink) 14px 15px, transparent 15px 19px); }

/* stamped strip of facts */
.agent-stats { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 56px; background: var(--card); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 0 4px 0 var(--ink); }
.agent-stats div { padding: 14px 16px; min-width: 0; }
.agent-stats div + div { border-left: 2px dashed var(--line); }
.agent-stats dt { font: 500 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.agent-stats dd { margin: 6px 0 0; font-size: clamp(1.2rem, 5vw, 1.6rem); line-height: 1.1; font-weight: 850; font-stretch: 112%; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-stats small { display: block; margin-top: 3px; font: 400 0.75rem/1.3 var(--sans); font-stretch: 100%; letter-spacing: 0; color: var(--muted); }

.agent { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 56px; align-items: start; }
.agent-info > .h-small:first-child { margin-top: 0; }

/* equipment tags */
.tool-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tool-tag { position: relative; display: grid; gap: 3px; align-content: start; padding: 13px 14px 13px 48px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 4px 8px 8px 4px; box-shadow: 0 3px 0 rgba(21, 32, 28, 0.85); transition: transform 0.25s var(--spring); }
.tool-tag:nth-child(odd) { transform: rotate(-0.6deg); }
.tool-tag:nth-child(even) { transform: rotate(0.5deg); }
.tool-tag:hover { transform: rotate(0) translateY(-2px); }
.tool-tag::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 34px; background: var(--cat, var(--ink)); border-radius: 2px 0 0 2px; }
.tool-hole { position: absolute; left: 9px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); z-index: 1; }
.tool-tag strong { font-weight: 800; font-stretch: 106%; }
.tool-tag span:last-child { color: var(--muted); font-size: 0.86rem; line-height: 1.4; }

/* the dispatch form: a carbon-copy tear-off sheet */
.agent-run { min-width: 0; }
.dispatch { --dc: var(--cat, var(--ink)); --rule: 22px; position: relative; margin-top: 12px; padding: 0 24px 24px; background: var(--card);
  filter: drop-shadow(0 1px 0 rgba(21, 32, 28, 0.08)) drop-shadow(0 14px 18px rgba(21, 32, 28, 0.13)); }
.dispatch:has(.run-form) { background-image: linear-gradient(90deg, transparent var(--rule), rgba(200, 64, 31, 0.3) var(--rule) calc(var(--rule) + 1px), transparent calc(var(--rule) + 1px)); }
.dispatch::before, .dispatch::after { content: ""; position: absolute; left: 0; right: 0; height: 10px; -webkit-mask: var(--perf); mask: var(--perf); }
.dispatch::before { top: -10px; background: var(--dc); transform: scaleY(-1); }
.dispatch::after { bottom: -10px; background: var(--card); }
.dispatch-head { display: flex; justify-content: space-between; gap: 10px; margin: 0 -24px 20px; padding: 12px 24px; background: var(--dc); color: #fff; font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.16em; }
.dispatch-head .mono { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: none; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.run-form { counter-reset: df; padding-left: 26px; }
.dispatch .field { margin-bottom: 18px; }
.dispatch .field label { display: block; font: 500 0.7rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.run-form .field label::before { counter-increment: df; content: counter(df, decimal-leading-zero) "  "; color: var(--stamp); white-space: pre; }
.dispatch .field :is(input, select, textarea) { background-color: rgba(255, 253, 248, 0.9); border-width: 1.5px 1.5px 3px; border-color: var(--line) var(--line) var(--ink-2); border-radius: 4px; }
.dispatch .field :is(input, select, textarea):focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(200, 64, 31, 0.16); }
.dispatch .opt { font-family: var(--sans); text-transform: none; letter-spacing: 0; }
.dispatch .btn-send { min-height: 56px; letter-spacing: 0.03em; }
.dispatch .note { font-size: 0.82rem; }
.run-output { margin-top: 28px; }
@media (min-width: 981px) and (min-height: 760px) {
  .agent-run .dispatch { position: sticky; top: 84px; }
  .agent-run:has(.slip) .dispatch { position: relative; top: auto; }
}
.empty-reviews { text-align: center; padding: 36px 20px 32px; border: 1.5px dashed var(--line); border-radius: 8px; background: rgba(251, 247, 239, 0.5); min-width: 0; }
.empty-reviews svg { width: 90px; margin: 0 auto 12px; }
.empty-reviews h3 { margin-bottom: 4px; }
.empty-reviews p { color: var(--muted); margin: 0 auto; max-width: 28rem; }
.reviews-grid.solo { grid-template-columns: minmax(0, 1fr); }
.run-output .slip { animation: feed 0.6s var(--ease); }
@keyframes feed { from { transform: translateY(-26px); opacity: 0; } }

/* reviews: slips pinned to a paper board */
.reviews-grid { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 44px; align-items: start; }
.big-rating { font-size: 1.1rem; }
.reviews-side > .h-small { margin-top: 0; }
.hist { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 8px; font: 0.8rem var(--mono); }
.hist li { display: grid; grid-template-columns: 30px minmax(0, 1fr) 28px; gap: 10px; align-items: center; }
.hist-bar { height: 12px; background: var(--paper-3); border-radius: 2px; overflow: hidden; }
.hist-bar span { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(var(--w)); border-radius: 2px; }
.review-form { padding: 16px; background: var(--card); border: 1.5px dashed var(--line); border-radius: 8px; }
.rate { border: 0; padding: 0; margin: 0 0 8px; display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.rate legend { margin-bottom: 4px; float: left; width: 100%; font: 500 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; }
.rate input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate label { font-size: 1.9rem; color: var(--line); cursor: pointer; padding: 0 2px; line-height: 1; transition: color 0.1s, transform 0.12s var(--ease); min-width: 40px; min-height: 44px; display: grid; place-items: center; }
.rate input:checked ~ label, .rate label:hover, .rate label:hover ~ label { color: var(--ochre); }
.rate label:active { transform: scale(1.2); }
.rate input:focus-visible + label { outline: 2px solid var(--stamp); border-radius: 4px; }
.review-form textarea { margin-bottom: 10px; }
.review-list { list-style: none; margin: 0; padding: 26px 22px 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 24px 20px; background: var(--paper-2); border-radius: 12px; box-shadow: inset 0 2px 8px rgba(21, 32, 28, 0.14), inset 0 0 0 1px var(--line); min-width: 0; }
.review-list:not(:has(.review)) { display: none; }
.review { position: relative; padding: 24px 18px 16px; background-color: #fffdf8; border-radius: 2px;
  background-image: repeating-linear-gradient(transparent 0 26px, rgba(45, 90, 112, 0.13) 26px 27px); background-position: 0 10px;
  box-shadow: 0 1px 0 rgba(21, 32, 28, 0.1), 0 10px 14px -10px rgba(21, 32, 28, 0.4); min-width: 0; }
.review:nth-child(odd) { transform: rotate(-0.7deg); }
.review:nth-child(even) { transform: rotate(0.6deg); }
.review .pin { position: absolute; top: -7px; left: 50%; width: 15px; height: 15px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e8603d, var(--stamp-ink)); box-shadow: 0 3px 3px rgba(21, 32, 28, 0.3); }
.review-top { display: flex; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; font-size: 0.82rem; margin-bottom: 8px; }
.review p { margin: 0; color: var(--ink); font-style: italic; line-height: 27px; overflow-wrap: anywhere; }

/* ============ run page: the desk ============ */
.desk { position: relative; max-width: 860px; margin: 0 auto; padding: 56px 28px 32px; border-radius: 18px; background-color: var(--paper-2);
  background-image: linear-gradient(rgba(21, 32, 28, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(21, 32, 28, 0.045) 1px, transparent 1px); background-size: 28px 28px;
  box-shadow: inset 0 0 0 1.5px var(--line), inset 0 14px 30px -18px rgba(21, 32, 28, 0.4); }
.desk-ruler { position: absolute; left: 28px; right: 28px; top: 16px; height: 14px; opacity: 0.4;
  background: repeating-linear-gradient(90deg, var(--ink-2) 0 1px, transparent 1px 10px) bottom / 100% 6px no-repeat, repeating-linear-gradient(90deg, var(--ink-2) 0 1px, transparent 1px 50px) bottom / 100% 13px no-repeat; }
.desk-head { text-align: center; }
.desk-head .back { margin-bottom: 8px; }
.desk-head h1 { overflow-wrap: anywhere; }
.desk-slip { position: relative; width: 100%; max-width: 600px; margin: 34px auto 30px; }
.desk .slip { width: 100%; }
.desk .slip-head { position: relative; padding-top: 30px; row-gap: 4px; }
.desk .slip-head .stamp { position: absolute; top: 0; right: 0; margin: 0; }
.desk-slip .slip { margin: 12px 0; }
.desk-clip { position: absolute; z-index: 2; top: -18px; left: 34px; width: 22px; height: 54px; color: #6b7a82; transform: rotate(6deg); filter: drop-shadow(0 2px 1px rgba(21, 32, 28, 0.25)); }
.after-slip { max-width: 600px; margin: 0 auto; display: flex; align-items: center; gap: 14px 16px; flex-wrap: wrap; padding: 16px 18px; background: rgba(251, 247, 239, 0.8); border: 1.5px dashed var(--ink-2); border-radius: 8px; }
.after-glyph { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 8px; background: var(--cat, var(--ink)); color: #fff; }
.after-glyph .glyph { width: 24px; height: 24px; }
.after-slip p { margin: 0; flex: 1 1 200px; display: grid; gap: 1px; min-width: 0; }
.after-slip p span { color: var(--muted); font-size: 0.88rem; }
.after-slip .btn { white-space: normal; text-align: center; }

/* ============ join: the courier pass ============ */
.join { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 460px); gap: 64px; justify-content: center; align-items: center; min-height: 60vh; padding-top: 8px; }
.pass-wrap { display: flex; flex-direction: column; align-items: center; transform-origin: 50% 0; animation: sway 6s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
.lanyard { width: 60px; height: 70px; margin-bottom: -10px; position: relative; z-index: 1; }
.pass { position: relative; width: 100%; max-width: 290px; padding: 0 20px 20px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--ink), var(--shadow-lift); overflow: hidden; }
.pass-top { display: flex; align-items: center; gap: 10px; margin: 0 -20px 18px; padding: 30px 20px 12px; background: var(--board); color: var(--board-ink); font: 500 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.14em; }
.pass-top .mark { width: 24px; height: 24px; flex: none; }
.pass-slot { position: absolute; z-index: 1; top: 10px; left: 50%; width: 46px; height: 9px; margin-left: -23px; border-radius: 6px; background: var(--paper); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.pass-id { display: flex; align-items: center; gap: 14px; }
.pass-photo { display: grid; place-items: center; width: 62px; height: 62px; flex: none; border-radius: 8px; background: var(--stamp); color: #fff; font-size: 2rem; font-weight: 850; font-stretch: 118%; text-transform: uppercase; }
.pass-id > div { min-width: 0; }
.pass-name { margin: 0; font-weight: 850; font-stretch: 112%; font-size: 1.15rem; line-height: 1.15; overflow-wrap: anywhere; }
.pass-handle { margin: 3px 0 0; font: 500 0.85rem var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.pass-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0; padding-top: 14px; border-top: 1.5px dashed var(--line); }
.pass-meta dt { font: 500 0.6rem var(--mono); text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.pass-meta dd { margin: 3px 0 0; font: 500 0.95rem var(--mono); }
.pass-bars { display: block; height: 30px; margin-top: 16px; opacity: 0.75; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 6px, transparent 6px 9px, var(--ink) 9px 12px, transparent 12px 14px, var(--ink) 14px 15px, transparent 15px 19px); }
.join-card { width: 100%; background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px; padding: 30px 28px; box-shadow: 0 5px 0 var(--ink), var(--shadow); }
.join-card form { margin-top: 22px; }
.join-card .field label { font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; }
.at-input { display: flex; align-items: center; border: 1.5px solid var(--line); border-bottom-width: 3px; border-bottom-color: var(--ink-2); border-radius: 4px; background: #fffdf8; }
.at-input:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(200, 64, 31, 0.16); }
.at-input span { padding-left: 14px; color: var(--muted); font-family: var(--mono); }
.at-input input { border: 0 !important; box-shadow: none !important; padding-left: 4px; background: transparent !important; }

/* ============ how credits work ============ */
.how-main .facts { margin: 40px 0 0; }
.how { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 56px; align-items: start; }
.how-receipt { position: relative; margin: 12px 0; padding: 26px 26px 22px; background: var(--card); filter: drop-shadow(0 1px 0 rgba(21, 32, 28, 0.08)) drop-shadow(0 14px 18px rgba(21, 32, 28, 0.13)); }
.how-receipt::before, .how-receipt::after { content: ""; position: absolute; left: 0; right: 0; height: 10px; background: var(--card); -webkit-mask: var(--perf); mask: var(--perf); }
.how-receipt::before { top: -10px; transform: scaleY(-1); }
.how-receipt::after { bottom: -10px; }
.how-receipt-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1.5px dashed var(--line); }
.itemised { margin: 18px 0 0; display: grid; gap: 14px; }
.itemised > div { display: flex; align-items: first baseline; gap: 10px; }
.itemised > div::before { content: ""; order: 1; flex: 1; min-width: 14px; border-bottom: 2px dotted var(--line); align-self: flex-start; height: 1.05em; }
.itemised dt { order: 0; flex: 0 1 auto; min-width: 0; }
.itemised dd { order: 2; margin: 0; font: 500 1.1rem var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.itemised em { font: 500 0.78rem var(--mono); font-style: normal; color: var(--muted); margin-left: 4px; }
.itemised small { display: block; font-size: 0.8rem; color: var(--muted); }
.it-main dt { font-weight: 800; font-stretch: 108%; }
.split { display: flex; gap: 3px; height: 16px; margin: 20px 0 6px; }
.split span { flex: var(--w) 1 0; min-width: 0; background: var(--green); border-radius: 3px 0 0 3px; }
.split span + span { background: var(--stamp); border-radius: 0 3px 3px 0; }
.it-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 20px; padding-top: 14px; border-top: 2px solid var(--ink); font: 500 1.25rem var(--mono); }
.it-total span:first-child { font: 800 1rem var(--sans); font-stretch: 110%; text-transform: uppercase; letter-spacing: 0.04em; }
.it-total small { font-size: 0.8rem; color: var(--muted); }
.it-refund { margin: 16px 0 0; padding-top: 12px; border-top: 1.5px dashed var(--line); font: 400 0.8rem/1.5 var(--mono); color: var(--ink-2); }
.facts { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 12px; }
.facts li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: center; }
.facts b { display: grid; place-items: center; min-height: 58px; padding: 0 6px; background: var(--board); color: var(--flap); border-radius: 6px; font: 500 1.5rem var(--mono); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.05); letter-spacing: -0.02em; white-space: nowrap; }
.facts span { color: var(--ink-2); text-wrap: pretty; }
.rules { position: relative; padding: 26px 26px 22px; background: var(--board); color: var(--board-ink); border-radius: 12px; box-shadow: 0 5px 0 #0b1210; }
.rules::before, .rules::after { content: ""; position: absolute; top: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--board-dim); opacity: 0.5; }
.rules::before { left: 14px; } .rules::after { right: 14px; }
.rules h2 { font-size: clamp(1.6rem, 3.4vw, 2rem); margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1.5px dashed var(--board-line); color: var(--board-ink); }
.rules .privacy { margin-top: 22px; padding-top: 16px; border-top: 1.5px dashed var(--board-line); max-width: none; color: var(--board-dim); }
.rules .privacy h3 { color: var(--board-ink); font-size: 1.1rem; margin-bottom: 6px; }
.rules .privacy p { margin: 0; }
.rules ol { list-style: none; counter-reset: rule; margin: 0; padding: 0; display: grid; gap: 12px; }
.rules li { counter-increment: rule; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; color: var(--board-ink); font-size: 0.97rem; }
.rules li::before { content: counter(rule); display: grid; place-items: center; width: 26px; height: 26px; margin-top: 1px; border-radius: 4px; background: rgba(240, 181, 74, 0.14); color: var(--flap); font: 500 0.85rem var(--mono); }

/* ============ builder: the clipboard ============ */
.builder { display: grid; grid-template-columns: 150px minmax(0, 1fr) 320px; grid-template-areas: "rail main prev"; gap: 0 28px; align-items: start; }
.b-rail { grid-area: rail; position: sticky; top: 92px; display: grid; gap: 6px; margin-right: -28px; padding-top: 18px; z-index: 1; }
.b-rail a { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; text-decoration: none; font-weight: 700; font-stretch: 105%; background: var(--paper-2); border: 1.5px solid var(--ink); border-right: 0; border-radius: 8px 0 0 8px; transition: transform 0.2s var(--ease), background-color 0.15s; }
.b-rail a b { font: 500 0.78rem var(--mono); color: var(--stamp-ink); }
.b-rail a:hover, .b-rail a:focus-visible { background: var(--card); transform: translateX(-6px); }
.b-main { grid-area: main; position: relative; min-width: 0; margin-top: 18px; padding: 46px 34px 32px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 8px 14px 14px 14px; box-shadow: 0 5px 0 var(--ink), var(--shadow); }
.b-main::before { content: ""; position: absolute; top: -18px; left: 50%; width: 130px; height: 32px; margin-left: -65px; border-radius: 7px; background: linear-gradient(#56646b, #2f3b41); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.b-main::after { content: ""; position: absolute; top: -9px; left: 50%; width: 56px; height: 8px; margin-left: -28px; border-radius: 4px; background: var(--paper); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.b-sec { border: 0; padding: 0 0 28px; margin: 0 0 28px; border-bottom: 1.5px dashed var(--line); min-width: 0; scroll-margin-top: 90px; }
.b-sec legend { padding: 0; margin-bottom: 16px; font-size: 1.3rem; font-weight: 850; font-stretch: 114%; letter-spacing: -0.01em; display: flex; align-items: center; gap: 12px; }
.b-n { display: inline-grid; place-items: center; padding: 3px 9px; border-radius: 4px; background: var(--board); color: var(--flap); font: 500 0.85rem var(--mono); letter-spacing: 0.06em; }
.b-sec > .muted { margin-top: -6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tool-picks, .model-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.model-picks { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.tool-pick, .model-pick { position: relative; display: flex; gap: 10px; align-items: flex-start; min-height: 56px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 6px; background: #fffdf8; cursor: pointer; transition: border-color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s; min-width: 0; }
.tool-pick:hover, .model-pick:hover { border-color: var(--ink-2); }
.tool-pick:has(input:checked), .model-pick:has(input:checked) { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px); }
.tool-pick input, .model-pick input { margin-top: 3px; accent-color: var(--stamp); width: 18px; height: 18px; flex: none; }
.tool-pick span, .model-pick span { display: grid; gap: 2px; min-width: 0; }
.tool-pick small, .model-pick small { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.model-pick .pick-meta { font: 500 0.72rem var(--mono); letter-spacing: 0.04em; color: var(--ink-2); margin-top: 2px; }
.b-main .field > label { font: 500 0.72rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.b-main .opt { font-family: var(--sans); text-transform: none; letter-spacing: 0; }
.b-fields { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; counter-reset: bf; }
.b-field { position: relative; background: #fffdf8; border: 1.5px solid var(--line); border-left: 5px solid var(--stamp); border-radius: 4px 8px 8px 4px; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; animation: slide-in 0.25s var(--ease); }
.b-field::before { counter-increment: bf; content: "Input " counter(bf, decimal-leading-zero); grid-column: 1 / -1; font: 500 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.b-field .field { margin: 0; min-width: 0; }
.b-field .field label { font: 500 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.b-field .wide { grid-column: 1 / -1; }
.b-field-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.b-field-foot label { display: inline-flex; gap: 8px; align-items: center; min-height: 40px; font-size: 0.9rem; cursor: pointer; }
.b-field-foot input { accent-color: var(--stamp); width: 18px; height: 18px; }
.b-remove { background: none; border: 1.5px dashed var(--stamp); border-radius: 4px; color: var(--stamp-ink); cursor: pointer; font-weight: 700; min-height: 40px; padding: 0 14px; transition: background-color 0.15s; }
.b-remove:hover { background: rgba(200, 64, 31, 0.08); }
.price-field { max-width: 260px; }
.b-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.b-preview { grid-area: prev; position: sticky; top: 92px; display: grid; gap: 10px; margin-top: 18px; max-height: calc(100svh - 108px); overflow-y: auto; overflow-x: hidden; padding: 4px 6px 16px; scrollbar-width: thin; align-content: start; }
.b-preview .eyebrow { margin: 4px 0 0; }
.ticket-preview { pointer-events: none; }
.ticket-preview:hover { transform: none; }
.dispatch-preview { margin-top: 18px; padding: 0 18px 18px; background-image: none; }
.dispatch-preview .dispatch-head { margin: 0 -18px 16px; padding: 10px 18px; }
.dispatch-preview .field { opacity: 0.9; margin-bottom: 14px; }
.dispatch-preview .field :is(input, select, textarea) { min-height: 42px; }
.dispatch-preview .muted { font-size: 0.88rem; }

/* ============ 404: return to sender ============ */
.nf { text-align: center; padding: 28px 0 60px; }
.nf p { margin: 0 auto 18px; }
.nf h1 { margin-bottom: 10px; }
.nf-env { position: relative; width: min(320px, 88%); margin: 0 auto 26px; }
.js .nf-env > svg { animation: drift 5s ease-in-out infinite; }
@keyframes drift { 50% { transform: translateY(-6px) rotate(-1deg); } }
.nf-env svg { width: 100%; height: auto; filter: drop-shadow(0 12px 12px rgba(21, 32, 28, 0.16)); }
.env-body { fill: var(--card); stroke: var(--ink); stroke-width: 2.5; }
.env-flap { fill: var(--paper-2); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.env-fold { fill: none; stroke: var(--line); stroke-width: 2; opacity: 0.6; }
.env-pstamp { fill: none; stroke: var(--ochre); stroke-width: 2.5; stroke-dasharray: 4 3; }
.env-pline { stroke: var(--ochre); stroke-width: 3; stroke-linecap: round; fill: none; }
.env-mark { fill: none; stroke: var(--muted); stroke-width: 1.8; opacity: 0.6; }
.env-addr { stroke: var(--line); stroke-width: 5; stroke-linecap: round; fill: none; }
.nf-env .stamp-big { position: absolute; left: 6%; bottom: 8%; margin: 0; background: rgba(251, 247, 239, 0.8); }

/* ============ responsive ============ */
@media (max-width: 1099px) {
  .builder { grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "rail rail" "main prev"; }
  .b-rail { position: static; display: flex; flex-wrap: wrap; margin: 0 0 10px; padding-top: 0; gap: 8px; }
  .b-rail a { border-right: 1.5px solid var(--ink); border-radius: 6px; }
  .b-rail a:hover, .b-rail a:focus-visible { transform: translateY(-2px); }
}
@media (max-width: 980px) {
  .agent { grid-template-columns: 1fr; gap: 36px; }
  .btn.jump-run { display: flex; }
  .reviews-grid { grid-template-columns: 1fr; gap: 24px; }
  .builder { grid-template-columns: minmax(0, 1fr); grid-template-areas: "prev" "rail" "main"; gap: 18px 0; }
  .b-preview { position: static; max-height: none; overflow: visible; margin-top: 0; padding: 0; }
  .b-preview .pv-slip-label, .dispatch-preview { display: none; }
  .b-rail { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 8px; margin: 0; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .b-rail a { flex: none; padding: 0 14px; color: var(--ink); }
  .join { grid-template-columns: minmax(0, 460px); gap: 30px; }
  .pass-wrap { animation-duration: 7s; }
  .how { grid-template-columns: minmax(0, 520px); gap: 40px; justify-content: center; }
}
@media (max-width: 760px) {
  .tool-picks, .model-picks, .grid2 { grid-template-columns: 1fr; }
  .price-field { max-width: none; }
  .agent-stats { grid-template-columns: 1fr 1fr; margin-bottom: 40px; }
  .agent-stats div:nth-child(3) { border-left: 0; }
  .agent-stats div:nth-child(n + 3) { border-top: 2px dashed var(--line); }
  .docket-bars, .docket-serial { display: none; }
  /* the docket lays down: stub becomes a band above the body */
  .docket { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .docket-stub { flex-direction: row; justify-content: space-between; padding: 16px 20px 22px; border-radius: 14px 14px 0 0;
    -webkit-mask: radial-gradient(circle at 0 100%, transparent 13px, #000 13.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 100%, transparent 13px, #000 13.5px) right / 51% 100% no-repeat;
    mask: radial-gradient(circle at 0 100%, transparent 13px, #000 13.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 100%, transparent 13px, #000 13.5px) right / 51% 100% no-repeat; }
  .docket-glyph { width: 32px; height: 32px; }
  .docket-cat { order: 2; flex: 1; text-align: left; padding-left: 4px; }
  .docket-price { order: 3; font-size: 2rem; display: flex; align-items: baseline; gap: 8px; }
  .docket-price small { margin: 0; }
  .docket-body { padding: 26px 22px 24px; border-radius: 0 0 14px 14px;
    -webkit-mask: radial-gradient(circle at 0 0, transparent 13px, #000 13.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 0, transparent 13px, #000 13.5px) right / 51% 100% no-repeat;
    mask: radial-gradient(circle at 0 0, transparent 13px, #000 13.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 0, transparent 13px, #000 13.5px) right / 51% 100% no-repeat; }
  .docket-body::before { left: 18px; right: 18px; top: 0; bottom: auto; border-left: 0; border-top: 2px dashed var(--line); }
  .docket-body .back { display: none; }
  .desk { padding: 52px 12px 24px; }
  .desk-ruler { left: 12px; right: 12px; }
  .desk-clip { left: 22px; }
  .facts li { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; }
  .facts b { font-size: 1.25rem; }
}
@media (max-width: 520px) {
  .dispatch { padding: 0 16px 20px; }
  .dispatch-head { margin: 0 -16px 18px; padding: 12px 16px; }
  .dispatch { --rule: 10px; }
  .run-form { padding-left: 18px; }
  .review-list { padding: 24px 14px 16px; }
  .b-main { padding: 40px 16px 24px; }
  .b-field { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .join-card { padding: 24px 18px; }
  .pass { max-width: 260px; }
  .how-receipt { padding: 22px 16px 18px; }
  .rules { padding: 24px 18px 18px; }
  .after-slip .btn { width: 100%; }
  .tool-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 340px) {
  .agent-stats div { padding: 12px; }
  .itemised dd { font-size: 1rem; }
  .facts li { grid-template-columns: 70px minmax(0, 1fr); }
}

/* Share control + reprint row */
.share { position: relative; display: inline-block; }
.share-btn, [data-reprint] { min-height: 44px; min-width: 44px; }
.share-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; display: grid; gap: 4px; min-width: min(220px, calc(100vw - 32px)); max-width: calc(100vw - 32px); padding: 6px; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 0 4px 0 rgba(21, 32, 28, 0.9); }
.share-pop[hidden] { display: none; }
.share-opt { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.share-opt:hover, .share-opt:focus-visible { background: rgba(21, 32, 28, 0.08); }
.share-opt:focus-visible { outline: 2px solid var(--stamp); outline-offset: -2px; }
.slip-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; }
@media (max-width: 420px) { .share-pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; max-width: none; } }

/* sample slip on the agent page */
.sample-slip { max-width: 680px; margin: 8px auto 28px; border: 1.5px dashed var(--ink-2); border-radius: 8px; background: rgba(251, 247, 239, 0.8); }
.sample-slip summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 14px 18px; font-weight: 600; min-height: 44px; }
.sample-slip summary::-webkit-details-marker { display: none; }
.sample-slip summary::after { content: "+"; margin-left: auto; font: 500 1.2rem/1 var(--mono); }
.sample-slip[open] summary::after { content: "\2212"; }
.sample-slip summary small { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.sample-slip-body { padding: 0 14px 16px; }
.sample-slip-body .slip { margin: 0 auto; width: 100%; }
