/* Loading bay (/a/:slug), delivery note (/r/:id), dispatch log (/runs), treasury (/earnings, /account). Loaded last. */

/* ---------- loading bay: one dark console + a spec plate ---------- */
.bay-grid { display: grid; gap: var(--s3); align-items: start; }
@media (min-width: 1000px) { .bay-grid { grid-template-columns: minmax(0, 1.28fr) minmax(300px, 1fr); gap: var(--s4); } }
.bay-console { min-width: 0; padding: var(--s2) var(--s2) var(--s3); background: var(--night); color: var(--night-ink); border-radius: 6px; box-shadow: 0 18px 40px -26px rgba(15, 27, 34, 0.7); }
@media (min-width: 1000px) {
  .bay-console { position: sticky; top: var(--s2); max-height: calc(100vh - var(--s4)); overflow-y: auto; overscroll-behavior: contain; padding: var(--s2) var(--s3) var(--s3); scrollbar-width: thin; scrollbar-color: var(--night-line) transparent; }
}
.bay-console :focus-visible { outline: 2px solid var(--buoy); outline-offset: 2px; }
.bay-band { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 28px; padding: 4px 10px; border-radius: 3px; background: var(--cat) repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 7px); font: 600 0.68rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #fff; }
.bay-code b { margin-left: 5px; padding: 0 4px; border: 1px solid #fff; border-radius: 2px; font-weight: 600; }
.bay-zone { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bay-live { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 2px 8px; border-radius: 2px; background: rgba(15, 27, 34, 0.72); }
.bay-live i { width: 7px; height: 7px; border-radius: 50%; background: #5fd7a3; }
.bay-draft { text-transform: none; letter-spacing: 0.02em; }
.bay-id { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s2); align-items: center; padding: var(--s2) 0; border-bottom: 1px solid var(--night-line); }
.bay-art { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #fff; flex: none; }
.bay-art .emblem { width: 44px; height: 44px; } .bay-art .glyph { width: 28px; height: 28px; color: var(--cat); }
.bay-title { min-width: 0; }
.bay-title h1 { margin: 0; color: #fff; font-size: clamp(1.7rem, 4.6vw, 2.5rem); overflow-wrap: anywhere; }
.bay-tag { margin: 6px 0 0; color: var(--night-dim); font-size: 0.98rem; line-height: 1.4; }
.bay-price { margin: 0; text-align: right; font: 500 0.8rem var(--mono); color: var(--night-dim); white-space: nowrap; }
.bay-price b { display: block; font: 600 1.9rem/1 var(--mono); color: var(--buoy); letter-spacing: -0.03em; }
.bay-price small { display: block; margin-top: 3px; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.bay-step { padding-top: var(--s3); }
.bay-out { margin-top: var(--s3); border-top: 1px dashed var(--night-line); }
.bay-console .sh-form .field label, .bay-console .sh-form .field { color: var(--night-ink); }
.bay-console .sh-form input, .bay-console .sh-form textarea, .bay-console .sh-form select { background: var(--night-2); border-color: var(--night-line); color: #fff; }
.bay-console .sh-form input::placeholder, .bay-console .sh-form textarea::placeholder { color: rgba(234, 241, 242, 0.42); }
.bay-console .sh-form .opt, .bay-console .sh-asks .opt { color: var(--night-dim); }
.bay-console .sh-form .try-example { color: var(--buoy); }
.bay-console .note { color: var(--night-dim); }
.bay-console .note a { color: #fff; }
.bay-console .sh-guest .btn, .bay-console .btn-send { background: var(--buoy); border-color: var(--buoy); color: var(--night); }
.bay-console .btn-send:disabled { opacity: 0.5; }
.bay-console .form-error { background: rgba(255, 120, 96, 0.12); color: #ffb9ab; }
.bay-console .run-output { display: grid; gap: 12px; min-width: 0; }
.bay-console .slip { color: var(--ink); margin: 0; }
.bay-console .slip-share .link-arrow { color: var(--petrol-ink); }

.bay-side { display: grid; gap: var(--s4); min-width: 0; }
.bay-plate { position: relative; padding: var(--s2) var(--s3) var(--s2); background: var(--surface); border: 2px solid var(--ink); border-radius: 6px; box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px var(--line-2); }
.bay-plate::before, .bay-plate::after { content: ""; position: absolute; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35); }
.bay-plate::before { left: 9px; } .bay-plate::after { right: 9px; }
.bay-plate-t { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 6px 0 var(--s1); padding: 0 6px 10px; border-bottom: 2px solid var(--ink); font: 600 0.78rem var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.bay-plate-t .mono { font-size: 0.72rem; letter-spacing: 0.06em; color: var(--muted); }
.bay-spec { margin: 0; }
.bay-spec > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line-2); align-items: baseline; }
.bay-spec dt { font: 500 0.66rem/1.5 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.bay-spec dd { margin: 0; font: 600 0.92rem/1.35 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bay-spec dd small { display: block; margin-top: 2px; font: 400 0.8rem/1.35 var(--sans, inherit); color: var(--muted); }
.bay-spec dd small:empty { display: none; }
.bay-hi dd { font-size: 1.5rem; color: var(--petrol-ink); letter-spacing: -0.03em; }
.bay-spec .by { min-height: 40px; }
.bay-spec .by > span:last-child { font-family: var(--sans, inherit); font-weight: 700; }
.bay-plate-foot { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; padding-top: var(--s2); }
.bay-plate-foot:not(:has(*)) { display: none; }
.bay-details { min-width: 0; }
.bay-details .sample-slip { margin-top: var(--s4); }
.ag-reviews { margin-top: var(--s6); }

@media (max-width: 520px) {
  .bay-id { grid-template-columns: auto minmax(0, 1fr); gap: 12px var(--s2); }
  .bay-art { width: 48px; height: 48px; } .bay-art .emblem { width: 38px; height: 38px; }
  .bay-price { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; text-align: left; }
  .bay-price b { display: inline; font-size: 1.5rem; } .bay-price small { display: inline; margin: 0; }
  .bay-spec > div { grid-template-columns: 96px minmax(0, 1fr); }
  .bay-plate { padding-inline: var(--s2); }
}

/* ---------- delivery note page ---------- */
.dn-head { max-width: 1040px; margin: 0 auto var(--s2); }
.dn-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); overflow-wrap: anywhere; }
.dn-grid { display: grid; gap: var(--s3); max-width: 1040px; margin: 0 auto; align-items: start; }
@media (min-width: 900px) { .dn-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 0; } }
.dn-doc { min-width: 0; }
.dn-doc .slip { box-shadow: 0 18px 36px -24px rgba(18, 32, 42, 0.5); }
.dn-stub { position: static; display: grid; gap: var(--s2); min-width: 0; }
@media (min-width: 900px) { .dn-stub { position: sticky; top: var(--s2); } }
.dn-card { position: relative; padding: 10px 18px 18px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--surface); }
@media (min-width: 900px) {
  .dn-card { border-left: 0; border-radius: 0 4px 4px 0; padding-left: 24px; }
  .dn-card::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 0; border-left: 3px dotted var(--line-2); }
}
.dn-stub-t { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 0; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font: 600 0.7rem var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.dn-stub-t .mono { letter-spacing: 0.04em; color: var(--muted); }
.dn-meta .dn-in dd { max-width: 62%; overflow-wrap: anywhere; font-size: 0.8rem; text-align: right; }
.dn-meta .dn-in dt { max-width: 38%; overflow-wrap: anywhere; }
.dn-stub .rn-cta { border-radius: 4px; }

/* ---------- dispatch log ---------- */
.dl-head { margin: 0 0 var(--s4); }
.dl-head h1 { margin-bottom: var(--s2); }
.dl-tally { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin: 0; }
.dl-tally > div { min-width: 0; }
.dl-tally dt { font: 500 0.66rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.dl-tally dd { margin: 2px 0 0; font: 600 1.7rem/1.1 var(--mono); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.dl-tally small { font-size: 0.8rem; color: var(--muted); }
.dl-log { display: grid; gap: var(--s4); }
.dl-month-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px var(--s2); margin: 0; padding: 0 0 var(--s1); border-bottom: 2px solid var(--ink); font-size: 1.35rem; }
.dl-month-h small { font: 500 0.72rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.dl-rows { list-style: none; margin: 0; padding: 0; position: relative; }
.dl-rows li + li { border-top: 1px solid var(--line); }
.dl-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) 96px 70px 90px; gap: 4px var(--s2); align-items: center; min-height: 56px; padding: 10px 8px; text-decoration: none; color: inherit; transition: background-color 0.15s; }
.dl-row:hover { background: color-mix(in srgb, var(--cat) 9%, transparent); }
.dl-row:focus-visible { outline: 2px solid var(--petrol); outline-offset: -2px; }
.dl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); }
.dl-failed .dl-dot { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 20%, transparent); }
.dl-running .dl-dot { background: var(--buoy); box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.25); animation: dl-pulse 1.4s ease-in-out infinite; }
@keyframes dl-pulse { 50% { transform: scale(1.25); } }
.dl-name { min-width: 0; display: grid; gap: 2px; }
.dl-name strong { font-weight: 750; letter-spacing: -0.005em; border-left: 4px solid var(--cat); padding-left: 10px; line-height: 1.2; }
.dl-name small { padding-left: 14px; color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-st, .dl-when { font: 500 0.72rem var(--mono); letter-spacing: 0.04em; color: var(--muted); }
.dl-cost { font: 600 0.88rem var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.dl-when { text-align: right; }
@media (max-width: 640px) {
  .dl-row { grid-template-columns: 14px minmax(0, 1fr) auto; grid-template-areas: "dot name cost" ". name when" ". st st"; }
  .dl-dot { grid-area: dot; } .dl-name { grid-area: name; } .dl-cost { grid-area: cost; } .dl-when { grid-area: when; } .dl-st { grid-area: st; }
}
@media (prefers-reduced-motion: reduce) { .dl-running .dl-dot { animation: none; } }

/* ---------- treasury: a ledger layout ---------- */
.tr-head { margin: 0 0 var(--s3); }
.tr-grid { display: grid; gap: var(--s3); align-items: start; }
@media (min-width: 900px) { .tr-grid { grid-template-columns: 320px minmax(0, 1fr); gap: var(--s4); } }
.tr-sum { display: grid; gap: 0; padding: var(--s3); background: var(--night); color: var(--night-ink); border-radius: 6px; min-width: 0; }
@media (min-width: 900px) { .tr-sum { position: sticky; top: var(--s2); } }
.tr-sum :focus-visible { outline: 2px solid var(--buoy); outline-offset: 2px; }
.tr-fig { padding: var(--s2) 0; border-bottom: 1px solid var(--night-line); }
.tr-fig:first-child { padding-top: 0; }
.tr-lab { display: block; font: 500 0.68rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--night-dim); }
.tr-big { margin: 6px 0 0; font: 500 clamp(2.1rem, 8vw, 2.9rem)/1 var(--mono); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; color: #fff; overflow-wrap: anywhere; }
.tr-big small { margin-left: 6px; font-size: 0.4em; letter-spacing: 0; color: var(--night-dim); }
.tr-main .tr-big { color: var(--buoy); }
.tr-sub { margin: 8px 0 0; font-size: 0.88rem; line-height: 1.45; color: var(--night-dim); }
.tr-sub a { color: #fff; background-image: linear-gradient(var(--buoy), var(--buoy)); }
.tr-note { margin: 0; padding: var(--s2) 0; border-bottom: 1px solid var(--night-line); font-size: 0.88rem; line-height: 1.5; color: var(--night-dim); }
.tr-note strong { display: block; margin-bottom: 4px; color: #fff; }
.tr-signout { padding-top: var(--s2); }
.tr-signout .btn { margin-top: var(--s2); background: transparent; color: #fff; border-color: var(--night-line); }
.tr-signout .btn:hover { border-color: var(--buoy); }
.tr-move.ea-move { margin-top: 0; padding: var(--s2) 0 0; background: transparent; border: 0; box-shadow: none; }
.tr-move label { color: #fff; }
.tr-move input { background: var(--night-2); border-color: var(--night-line); color: #fff; }
.tr-move input:focus { border-color: var(--buoy); box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.25); }
.tr-move .btn { background: var(--buoy); border-color: var(--buoy); color: var(--night); }
.tr-move .btn:disabled { opacity: 0.45; }
.tr-move .note, .tr-move .ea-hint { color: var(--night-dim); }
.tr-move .form-error { background: rgba(255, 120, 96, 0.12); color: #ffb9ab; }
.tr-main-col { min-width: 0; display: grid; gap: var(--s4); }
.tr-chart.ea-chart { border-radius: 6px; border-top: 2px solid var(--ink); box-shadow: none; }
.tr-sec { margin: 0; }
.tr-sec .pg-section-head, .tr-statement .pg-section-head { margin-bottom: var(--s2); }
.tr-statement { display: block; }
.tr-table .tr-bal { color: var(--muted); }
.tr-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-2) 35%, transparent); }
.pg-table-wrap { border-radius: 6px; }

/* compact manifest: short fields pair up so the delivery note stays in view */
@media (min-width: 1000px) {
  .bay-console .run-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s2); }
  .bay-console .run-form > * { grid-column: 1 / -1; }
  .bay-console .run-form > .field:not(:has(textarea)) { grid-column: auto; }
  .bay-console .run-form .field { margin-bottom: 12px; }
  .bay-console .run-form .field input, .bay-console .run-form .field select { height: 44px; }
  .bay-console .bay-id { padding: 12px 0; }
  .bay-console .bay-step { padding-top: var(--s2); }
}

/* round 2: one main column (console, then details), the spec plate is the sticky side column */
.bay-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "console" "plate" "details"; gap: var(--s3); }
.bay-console { grid-area: console; }
.bay-plate { grid-area: plate; }
.bay-details { grid-area: details; }
@media (min-width: 1000px) {
  .bay-grid { grid-template-columns: minmax(0, 720px) minmax(280px, 1fr); grid-template-areas: "console plate" "details plate"; gap: var(--s4); }
  .bay-console { position: static; max-height: none; overflow: visible; }
  .bay-plate { position: sticky; top: var(--s2); align-self: start; }
}
.bay-details > .ag-h:first-child { margin-top: 0; }
.bay-art { background: var(--cat); border-radius: 8px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18); overflow: hidden; }
.bay-art .emblem { width: 100%; height: 100%; border-radius: 0; }
.bay-art .glyph { width: 62%; height: 62%; color: #fff; }
/* the side plate is narrow: label above value so tool lists and handles don't break mid-word */
@media (min-width: 1000px) {
  .bay-plate .bay-spec > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .bay-plate .bay-spec dd { overflow-wrap: anywhere; }
}
