/* Bidmoor application, wide screens first: top navigation, a deadline-first register and a document-like quote editor. */
.app-body { --bar: 40px; }
.app-body .demo-bar { position: sticky; top: 0; z-index: 25; height: var(--bar); flex-wrap: nowrap; white-space: nowrap; }
.masthead { position: sticky; top: var(--bar); z-index: 12; }
.mast-row { display: flex; align-items: center; gap: 18px; height: 58px; padding: 0 24px; background: var(--navy); color: #fff; }
.mast-co { padding-left: 18px; border-left: 1px solid #50545a; color: #c9ccd1; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.jump { position: relative; flex: 0 1 320px; margin-left: auto; }
.jump > .icon { position: absolute; left: 11px; top: 10px; color: #b9bdc3; }
.jump input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid #50545a; border-radius: var(--radius); background: #303337; color: #fff; }
.jump input::placeholder { color: #b9bdc3; }
.results { position: absolute; z-index: 20; top: 44px; left: 0; right: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: 0 16px 34px -14px rgba(20, 22, 26, .4); color: var(--ink); }
.results a { display: block; padding: 8px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.results a:hover { background: var(--accent-tint); }
.results span { display: block; font-size: 13px; color: var(--ink-2); }
.results .none { padding: 8px 10px; color: var(--ink-2); }
.user-wrap { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 3px 8px 3px 4px; border: 1px solid transparent; border-radius: var(--radius); background: none; color: #fff; text-align: left; cursor: pointer; }
.user-btn:hover { border-color: #50545a; }
.user-text { display: grid; line-height: 1.25; white-space: nowrap; }
.user-text strong { font-size: 13.5px; font-weight: 600; }
.user-text small { font-size: 12.5px; color: #c9ccd1; }
.avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: var(--radius); background: var(--accent-tint); color: var(--accent-dark); font-size: 13px; font-weight: 700; }
.usermenu { position: absolute; right: 0; top: 48px; z-index: 22; width: 264px; padding: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: 0 18px 38px -16px rgba(20, 22, 26, .45); color: var(--ink); }
.usermenu .whoami { display: flex; gap: 10px; align-items: center; padding: 4px 6px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); line-height: 1.3; }
.usermenu .whoami strong { display: block; }
.usermenu .whoami span { font-size: 13px; color: var(--ink-2); }
.usermenu .whoami .avatar { color: var(--accent-dark); }
.usermenu > :is(button, a) { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 8px; border: 0; border-radius: var(--radius); background: none; color: var(--ink); text-decoration: none; cursor: pointer; text-align: left; }
.usermenu > :is(button, a):hover { background: var(--accent-tint); }
.mast-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.mast-nav .tabs { display: flex; gap: 6px; padding: 0 18px; overflow-x: auto; scrollbar-width: none; }
.mast-nav .tabs::-webkit-scrollbar { display: none; }
.mast-nav li { flex: none; }
.mast-nav a { display: flex; align-items: center; gap: 7px; height: 48px; padding: 0 10px; border-bottom: 3px solid transparent; border-top: 3px solid transparent; color: var(--ink-2); font-weight: 500; text-decoration: none; white-space: nowrap; }
.mast-nav a:hover { color: var(--ink); border-bottom-color: var(--line-2); }
.mast-nav a.is-active { color: var(--accent-dark); font-weight: 600; border-bottom-color: var(--accent); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--soft); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.pill-count { background: var(--accent); color: #fff; }

.content { max-width: 1360px; margin: 0 auto; padding: 24px 24px 56px; }
.content > * + * { margin-top: 16px; }
.page-head, .record-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head h1, .record-head h1, .locked h1 { font: 600 31px/1.15 var(--head); }
.page-head p, .record-head p { margin-top: 3px; color: var(--ink-2); }
.record-head > div:first-child { min-width: 0; flex: 1 1 380px; }
.record-id { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.page-actions, .actionbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.actionbar:empty { display: none; }
.back { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; font-weight: 600; font-size: 13.5px; text-decoration: none; }
.back + * { margin-top: 4px; }
.ref { color: var(--ink-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-2); font-size: 13px; }
.late, .down { color: var(--danger); font-weight: 600; }

.card { min-width: 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-flush, .card-list { padding: 0; overflow: hidden; }
.card-list > .card-head { padding: 14px 18px 0; }
.card-list > .empty { padding-bottom: 24px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 12px; }
.card-head a:not(.btn) { font-size: 13.5px; font-weight: 600; }
.card h2, .sheet h2, .register h2 { font: 600 20px/1.25 var(--head); }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.columns-wide { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.columns-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }
.column { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; color: var(--ink); text-decoration: none; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.stat:hover { background: #faf6f3; }
.stat-name { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.stat-value { font: 600 32px/1.15 var(--head); font-variant-numeric: lining-nums tabular-nums; }
.stat-sub { color: var(--ink-2); font-size: 13px; }

.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.tone-ok { background: var(--ok-tint); color: var(--ok); }
.tone-neutral { background: var(--soft); color: #383b41; }
.tone-warn { background: var(--warn-tint); color: var(--warn); }
.tone-danger { background: var(--danger-tint); color: var(--danger); }
.tone-info { background: var(--info-tint); color: var(--info); }
.tone-wait { background: var(--wait-tint); color: var(--wait); }
.tone-accent { background: var(--accent); color: #fff; }
.tone-line { box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); }

/* Filters */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.toolbar > .filterbar { flex: 1 1 100%; }
.filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.filter-selects { display: flex; flex-wrap: wrap; gap: 10px; }
.filter { display: grid; gap: 2px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.filter select { min-height: 40px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 400; }
.searchfield { display: flex; align-items: center; gap: 9px; flex: 1 1 240px; max-width: 360px; min-height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--ink-2); }
.searchfield:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.searchfield input { flex: 1; min-width: 0; height: 38px; border: 0; background: none; color: var(--ink); outline: none; }
.content .tabs:not(.mast-nav .tabs) { display: flex; gap: 4px; max-width: 100%; padding: 4px; overflow-x: auto; background: #e1e4e7; border-radius: var(--radius-lg); scrollbar-width: none; overscroll-behavior-x: contain; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 34px; padding: 0 13px; border: 0; border-radius: var(--radius); background: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none; }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 22, 26, .18); }
.list-count { margin-bottom: 8px; color: var(--ink-2); font-size: 13.5px; }
.empty { padding: 22px 16px; text-align: center; }
.empty h3 { font-size: 15px; }
.empty p { margin-top: 2px; color: var(--ink-2); }
.empty .btn { margin-top: 12px; }

/* Deadline leaf and register rows */
.leaf { display: grid; justify-items: center; align-content: center; flex: none; width: 60px; padding: 4px 0 3px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); line-height: 1.15; }
.leaf small { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.leaf b { font: 600 23px/1.05 var(--head); font-variant-numeric: lining-nums; }
.leaf em { font-style: normal; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.leaf.is-soon { border-color: var(--accent); background: var(--accent-tint); }
.leaf.is-soon :is(small, em) { color: var(--accent-dark); font-weight: 700; }
.leaf.is-late { border-color: var(--danger); background: var(--danger-tint); }
.leaf.is-late :is(small, em, b) { color: var(--danger); font-weight: 700; }
.leaf.is-none { border-style: dashed; }
.register + .register { margin-top: 22px; }
.register h2 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.register h2 span { color: var(--ink-2); font: 500 13px var(--font); }
.register .bidlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.register .bidlist + .bidlist { margin-top: -1px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.bidlist:empty { display: none; }
#results { container-type: inline-size; }
.card-list, .column { container-type: inline-size; }
.bidlist > li + li { border-top: 1px solid var(--line); }
.card-list > .card-head + .bidlist { border-top: 1px solid var(--line); }
.bid { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; grid-template-areas: "leaf main value" "leaf main status"; column-gap: 14px; row-gap: 4px; align-items: center; padding: 11px 18px; color: var(--ink); text-decoration: none; }
.bid:hover { background: #faf6f3; }
.bid > .leaf { grid-area: leaf; }
.bid-main { grid-area: main; display: grid; min-width: 0; line-height: 1.4; }
.bid-main strong { font-weight: 600; }
.bid-main > span { color: var(--ink-2); font-size: 13.5px; }
.bid-main small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink-2); font-size: 13px; }
.bid-meta { display: none; }
.bid-status { grid-area: status; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.bid-value { grid-area: value; justify-self: end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.no-leaf .bid { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main value" "main status"; }
@container (min-width: 880px) {
  .bid { grid-template-columns: 60px minmax(0, 1fr) 140px 210px 124px; grid-template-areas: "leaf main meta status value"; }
  .bid-meta { grid-area: meta; display: grid; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
  .bid-status { justify-content: flex-start; }
}

/* Dashboard lists */
.decide li + li { border-top: 1px solid var(--line); }
.decide a { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 10px 0; color: var(--ink); text-decoration: none; }
.decide li:first-child a { padding-top: 0; }
.decide a:hover strong { color: var(--accent-dark); text-decoration: underline; }
.decide a > span { display: grid; min-width: 0; line-height: 1.45; }
.decide small { color: var(--ink-2); font-size: 13px; }
.decide em { color: var(--warn); font-style: normal; font-size: 13px; font-weight: 500; }
.decide b { font-variant-numeric: tabular-nums; white-space: nowrap; }

.fu { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; padding: 11px 0; }
.fulist > li + li { border-top: 1px solid var(--line); }
.fulist > li:first-child { padding-top: 0; }
.fulist > li:last-child { padding-bottom: 0; }
.fu-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius); background: var(--soft); color: var(--accent-dark); }
.fu.is-late .fu-icon { background: var(--danger-tint); color: var(--danger); }
.fu-main { display: grid; flex: 1 1 200px; min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.fu-main strong { font-weight: 600; }
.fu-main > span { font-size: 13.5px; color: var(--ink-2); }
.fu-main small { font-size: 13px; color: var(--ink-2); }
.fu.is-late small { color: var(--danger); font-weight: 600; }
.fu-act { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.bare li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.bare a { color: var(--ink); text-decoration: none; }

/* The quote: a document with a sticky totals column */
.quote { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 18px; align-items: start; }
.rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-self: stretch; align-content: start; }
.sheet { container-type: inline-size; min-width: 0; padding: 26px 30px 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 1px 0 var(--line), 0 18px 34px -28px rgba(20, 22, 26, .5); }
.sheet > h2:not(:first-child) { margin: 24px 0 10px; }
.sheet-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 14px; border-bottom: 3px solid var(--accent); }
.sheet-top > div { display: grid; line-height: 1.4; }
.sheet-top strong { font: 600 22px/1.2 var(--head); }
.sheet-top span { color: var(--ink-2); font-size: 13px; }
.sheet-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 14px 0 6px; }
.sheet-meta dt, .paper-to dt { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.sheet-lines-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 4px; }
.sheet-lines-head > span { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet .brief { margin: 10px 0 16px; max-width: 70ch; }
.sheet > p .btn { margin-top: 18px; }
.lines { border-top: 1px solid var(--ink); }
.line { border-bottom: 1px solid var(--line); }
.line-read { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; }
.line-read > span, .line-tap > span { display: grid; min-width: 0; line-height: 1.45; }
.line-read strong { font-weight: 600; }
.line-read small, .line-tap small { color: var(--ink-2); font-size: 13px; }
.line-read .inner-note { color: var(--accent-dark); }
.line b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.line.is-edit { padding: 10px 0 12px; }
.line-head { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(96px, auto) 36px; gap: 10px; align-items: center; }
.line-head b { text-align: right; font-size: 15px; }
.line-head .icon-btn { width: 34px; height: 34px; border-color: transparent; color: var(--ink-2); }
.line-head .icon-btn:hover { color: var(--danger); background: var(--danger-tint); }
.line-desc { width: 100%; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius); background: none; font-weight: 600; text-overflow: ellipsis; }
.line-desc:hover { border-color: var(--line-2); }
.line-desc:focus { border-color: var(--accent); background: var(--surface); }
.line-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 0 68px; }
.cell { display: grid; gap: 1px; min-width: 0; }
.cell > span { color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell input:not([type="checkbox"]) { width: 100%; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: #fbfcfc; font-variant-numeric: tabular-nums; text-align: right; }
.cell input:focus { border-color: var(--accent); background: var(--surface); }
.cell output { display: flex; align-items: center; justify-content: flex-end; height: 34px; font-variant-numeric: tabular-nums; }
.cell.is-out > span { text-align: right; }
.cell.is-check { display: flex; align-items: flex-end; gap: 6px; height: 100%; padding-bottom: 7px; }
.cell.is-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.cell.is-check span { color: var(--ink); font-size: 13px; }
@container (min-width: 660px) { .line-cells { grid-template-columns: repeat(5, minmax(0, 1fr)) 64px; } }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger); }
.line-error { margin: 8px 0 0 68px; padding: 6px 10px; border-radius: var(--radius); background: var(--danger-tint); color: var(--danger); font-size: 13px; font-weight: 600; }
.terms-read h2 { margin: 22px 0 4px; font-size: 18px; }
.terms-read p { max-width: 68ch; color: var(--ink-2); }
.terms-read > .btn { width: 100%; margin-top: 16px; }
.quote-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.quote-extra { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; align-items: start; }
.quote-extra > .card-history { max-height: 420px; overflow-y: auto; }
.totals { position: sticky; top: calc(var(--bar) + 120px); z-index: 2; border-top: 3px solid var(--accent); }
.totals h2 { margin-bottom: 6px; }
.sumlines > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.sumlines dt { color: var(--ink-2); }
.sumlines dd { font-variant-numeric: tabular-nums; text-align: right; }
.sumlines .grand { margin-top: 4px; padding-top: 8px; border-top: 2px solid var(--ink); align-items: baseline; }
.sumlines .grand dt { color: var(--ink); font-weight: 600; }
.sumlines .grand dd { font: 600 27px/1.2 var(--head); font-variant-numeric: lining-nums tabular-nums; }
.sumlines.inner { margin-top: 10px; padding: 6px 10px; background: var(--soft); border-radius: var(--radius); font-size: 13.5px; }
.gauge { position: relative; height: 8px; margin-top: 12px; border-radius: 99px; background: var(--soft); }
.gauge i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--ok); transition: width .25s ease-out; }
.gauge i.is-low { background: var(--danger); }
.gauge b { position: absolute; top: -4px; width: 3px; height: 16px; margin-left: -1px; border-radius: 2px; background: var(--ink); }
.gauge-key { display: flex; justify-content: space-between; margin-top: 5px; color: var(--ink-2); font-size: 12px; }
.verdict { display: flex; gap: 9px; margin-top: 10px; padding: 9px 11px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.45; }
.verdict > div { display: grid; gap: 2px; }
.verdict .icon { margin-top: 1px; }
.verdict.is-hold { background: var(--wait-tint); color: #4a3600; }
.verdict.is-clear { background: var(--ok-tint); color: #14492a; }
.totals-act { display: grid; gap: 6px; margin-top: 12px; }
.saved-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; }
.saved-note .icon { width: 14px; height: 14px; }
.versions li + li { border-top: 1px solid var(--line); }
.versions a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; color: var(--ink); text-decoration: none; }
.versions a:hover strong { text-decoration: underline; }
.versions a > span { display: grid; min-width: 0; line-height: 1.4; }
.versions strong { font-size: 13.5px; font-weight: 600; }
.versions small { color: var(--ink-2); font-size: 12.5px; }
.versions b { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history li { position: relative; display: grid; padding: 0 0 12px 18px; line-height: 1.45; }
.history li::before { content: ""; position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 99px; background: var(--accent); }
.history li:not(:last-child)::after { content: ""; position: absolute; left: 3px; top: 15px; bottom: 0; width: 1px; background: var(--line-2); }
.history span { font-size: 13.5px; overflow-wrap: anywhere; }
.history small { color: var(--ink-2); font-size: 12.5px; }
.past { margin-top: 12px; }
.past summary { min-height: 30px; color: var(--accent-dark); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.past > .fulist { margin-top: 8px; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); background: var(--soft); }
.callout .icon { margin-top: 2px; }
.callout-warn { background: var(--warn-tint); }
.callout-info { background: var(--info-tint); }
.callout-ok { background: var(--ok-tint); }
.facts > div { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { flex: none; color: var(--ink-2); }
.facts dd { min-width: 0; text-align: right; overflow-wrap: anywhere; font-weight: 500; }
.notes { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--soft); font-size: 13.5px; }
.totalbar { display: none; }

/* Compare */
.cmp { container-type: inline-size; }
.cmp-row { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)) 128px; gap: 14px; align-items: start; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-headrow { background: #f6f7f8; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.cmp-name { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.cmp-name strong { font-weight: 600; }
.cmp-side { display: grid; min-width: 0; font-variant-numeric: tabular-nums; }
.cmp-side small { color: var(--ink-2); font-size: 12.5px; }
.cmp-side .muted { font-size: 13px; }
.cmp-diff { text-align: right; font-variant-numeric: tabular-nums; }
.cmp-row.is-same .cmp-diff { color: var(--ink-2); font-weight: 400; }
.cmp-row.is-total { background: #f6f7f8; }

/* The client copy */
.paper { max-width: 820px; margin-inline: auto; padding: 48px 52px; background: var(--surface); border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 22px 44px -30px rgba(20, 22, 26, .55); container-type: inline-size; }
.paper header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; padding-bottom: 18px; border-bottom: 3px solid var(--accent); }
.paper-brand { font: 600 24px/1.2 var(--head); }
.paper header p:not(.paper-brand) { color: var(--ink-2); font-size: 13.5px; }
.paper-no { text-align: right; }
.paper-no h2 { font: 600 30px/1.1 var(--head); color: var(--accent-dark); }
.paper-stamp { margin-bottom: 14px; padding: 6px 10px; border: 1.5px dashed var(--warn); border-radius: var(--radius); color: var(--warn); font-weight: 600; text-align: center; }
.paper-to { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 20px 0 24px; font-size: 13.5px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.paper th { padding: 8px 6px; border-bottom: 1px solid var(--ink); font-size: 12.5px; text-align: left; }
.paper td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.paper :is(th, td):first-child { padding-left: 0; }
.paper :is(th, td):last-child { padding-right: 0; }
.paper td small { display: block; color: var(--ink-2); font-size: 12px; }
.paper .num { text-align: right; }
.paper td.num { white-space: nowrap; }
.paper-sums { max-width: 300px; margin: 14px 0 0 auto; }
.paper-terms h3 { margin: 20px 0 2px; font: 600 17px var(--head); }
.paper-terms p { font-size: 13.5px; color: var(--ink-2); }
.paper-sign { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; margin-top: 52px; }
.paper-sign span { padding-top: 5px; border-top: 1px solid var(--ink); color: var(--ink-2); font-size: 12.5px; }
@container (max-width: 520px) {
  .paper thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .paper tbody, .paper tr { display: block; }
  .paper tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .paper td { display: block; padding: 0; border: 0; }
  .paper td:first-child { grid-column: 1 / -1; }
  .paper td.num[data-l] { grid-column: 1; text-align: left; color: var(--ink-2); font-size: 13px; }
  .paper td.num[data-l]::before { content: attr(data-l) ": "; }
  .paper td:last-child { grid-column: 2; grid-row: 2 / span 2; align-self: end; font-weight: 600; }
  .paper-to { grid-template-columns: minmax(0, 1fr); }
  .paper-no { text-align: left; }
}

/* Approvals */
.asks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.asks > li { display: flex; flex-direction: column; gap: 12px; }
.ask-top { display: flex; gap: 14px; align-items: flex-start; }
.ask-top h2 a { color: var(--ink); text-decoration: none; }
.ask-top h2 a:hover { text-decoration: underline; }
.ask-top p { color: var(--ink-2); font-size: 13.5px; }
.why li { display: flex; gap: 8px; padding: 7px 10px; background: var(--wait-tint); color: #4a3600; border-radius: var(--radius); font-size: 13.5px; font-weight: 500; }
.why li + li { margin-top: 6px; }
.why .icon { margin-top: 2px; width: 16px; height: 16px; }
.ask-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px 0; border-block: 1px solid var(--line); }
.ask-figs dt { color: var(--ink-2); font-size: 12.5px; }
.ask-figs dd { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ask-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* Pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(214px, 1fr); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.board section { min-width: 0; padding: 10px; background: #e3e6e8; border-radius: var(--radius-lg); }
.board h2 { display: flex; justify-content: space-between; gap: 8px; font: 600 18px var(--head); }
.board h2 span { font: 600 13px var(--font); color: var(--ink-2); }
.board section > p { margin-bottom: 8px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.board li + li { margin-top: 8px; }
.board a { display: grid; gap: 2px; padding: 10px 11px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; line-height: 1.4; }
.board a:hover { border-color: var(--accent); }
.board a strong { font-size: 13.5px; font-weight: 600; }
.board a > span { font-size: 12.5px; color: var(--ink-2); }
.board .board-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; margin-top: 4px; }
.board-foot b { color: var(--ink); font-size: 13px; }
.board-none { padding: 10px; color: var(--ink-2); font-size: 13px; text-align: center; }

/* Client and price rows */
.rows { container-type: inline-size; }
.rows > li + li { border-top: 1px solid var(--line); }
.rows a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 18px; color: var(--ink); text-decoration: none; }
.rows a:hover { background: #faf6f3; }
.rows-lib .ref { width: 54px; }
.rows-main { display: grid; min-width: 0; line-height: 1.4; }
.rows-main strong { font-weight: 600; }
.rows-main span { color: var(--ink-2); font-size: 13.5px; }
.rows-col { display: none; color: var(--ink-2); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.rows-col small { display: block; font-size: 12px; }
.rows-end { display: grid; justify-items: end; gap: 2px; font-variant-numeric: tabular-nums; }
.rows-end small { color: var(--ink-2); font-size: 12.5px; }
@container (min-width: 760px) {
  .rows-clients a { grid-template-columns: auto minmax(0, 1fr) 160px 130px 150px; }
  .rows-lib a { grid-template-columns: 54px minmax(0, 1fr) 100px 90px 120px; }
  .rows-col { display: block; }
}

.mini { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.mini th { padding: 6px 4px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); font-size: 12.5px; text-align: left; }
.mini td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.mini .num { text-align: right; }
.mini :is(th, td):first-child { padding-left: 0; }
.mini :is(th, td):last-child { padding-right: 0; }
.rules { display: grid; gap: 16px; max-width: 560px; }

.locked { max-width: 520px; margin: 48px auto; text-align: center; }
.locked > .icon { width: 36px; height: 36px; margin: 0 auto 12px; color: var(--accent); }
.locked p { margin: 8px 0 18px; color: var(--ink-2); }

/* Role choice */
.signin { max-width: 960px; margin: 0 auto; padding: 44px 20px 64px; text-align: center; }
.signin h1 { margin-top: 30px; font: 600 clamp(28px, 4vw, 40px)/1.12 var(--head); }
.signin-sub { max-width: 60ch; margin: 8px auto 0; color: var(--ink-2); }
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 26px; text-align: left; }
.role { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; height: 100%; padding: 20px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.role:hover { border-color: var(--accent); transform: translateY(-2px); }
.role-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius); background: var(--accent-tint); color: var(--accent-dark); }
.role-icon .icon { width: 23px; height: 23px; }
.role-title { margin-top: 10px; font: 600 23px/1.2 var(--head); }
.role-name { color: var(--accent-dark); font-weight: 600; font-size: 13.5px; }
.role-short { display: none; }
.role-points { display: grid; gap: 7px; margin-top: 12px; color: var(--ink-2); font-size: 13.5px; }
.role-points > span { display: flex; gap: 8px; }
.role-points .icon { width: 15px; height: 15px; margin-top: 3px; color: var(--ok); }
@media (max-width: 860px) { .roles { grid-template-columns: minmax(0, 1fr); } }
.noscript { padding: 40px; text-align: center; }

/* Popups: the title and buttons stay in view while the fields scroll */
.icon-btn { position: relative; display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.icon-btn:hover { background: var(--bg); }
dialog { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 0; border-radius: 10px; color: var(--ink); overflow: hidden; box-shadow: 0 30px 70px -20px rgba(20, 22, 26, .55); }
dialog::backdrop { background: rgba(24, 26, 30, .56); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 40px); }
dialog.is-tall form { height: 640px; }
.modal-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font: 600 21px/1.2 var(--head); }
.modal-body { flex: 1; min-height: 0; padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; }
.modal-body > * + * { margin-top: 12px; }
.modal-foot { display: flex; flex: none; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.form-grid.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sheet .form-grid + .form-grid { margin-top: 12px; }
.wide { grid-column: 1 / -1; }
.modal-note { color: var(--ink-2); }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.field em { font-style: normal; font-weight: 400; }
.field :is(input, select, textarea) { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.field textarea { resize: vertical; }
.error { display: block; color: var(--danger); font-size: 13px; font-weight: 600; }
.error:empty { display: none; }
.form-error { padding: 9px 12px; border-radius: var(--radius); background: var(--danger-tint); color: var(--danger); font-weight: 600; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 36px; padding: 6px 0; cursor: pointer; }
.check input { flex: none; width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--accent); }
.picker-search { max-width: none; }
.picker li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.picker li > span { display: grid; min-width: 0; line-height: 1.4; }
.picker small { color: var(--ink-2); font-size: 13px; }
.picker .btn { min-width: 68px; }
.line-preview { font-weight: 600; font-variant-numeric: tabular-nums; }

.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: var(--radius); background: var(--navy); color: #fff; box-shadow: 0 12px 28px -12px rgba(20, 22, 26, .6); }
.toast .icon { margin-top: 2px; color: #9fd6a6; }
.toast-warn .icon { color: #ffc35c; }

@media (max-width: 1240px) {
  .mast-nav a .icon { display: none; }
  .mast-nav .tabs { gap: 6px; }
}
@media (max-width: 1160px) {
  .columns, .columns-wide, .columns-side { grid-template-columns: minmax(0, 1fr); }
  .quote { grid-template-columns: minmax(0, 1fr) 292px; gap: 14px; }
  .sheet { padding: 20px 18px 24px; }
  .asks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .mast-co, .user-text { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote { grid-template-columns: minmax(0, 1fr); }
  .rail { order: -1; }
  .totals { position: static; }
}
@media (max-width: 960px) and (min-width: 761px) {
  .quote { display: flex; flex-direction: column; align-items: stretch; }
  .rail, .quote-col { display: contents; }
  .quote-extra { order: 2; }
  .sheet { order: 1; }
  .totals { order: 0; position: sticky; top: calc(var(--bar) + 106px); }
  .totals .sumlines.inner, .totals .gauge, .totals .gauge-key, .totals h2, .totals .saved-note, .totals .sumlines > div:not(.grand) { display: none; }
  .totals { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; align-items: center; padding: 10px 16px; }
  .totals #figures { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
  .totals .sumlines .grand { display: grid; border: 0; margin: 0; padding: 0; }
  .totals .sumlines .grand dd { text-align: left; }
  .totals .verdict { margin: 0; }
  .totals-act { margin: 0; }
}

/* Printing the client copy: only the document */
@media print {
  .demo-bar, .masthead, .m-bar, .m-tabs, .m-fab, .toasts, .preview, .back, .no-print, .skip { display: none !important; }
  body { background: #fff; }
  .app-body .content { max-width: none; padding: 0; }
  .paper { max-width: none; padding: 0; border: 0; box-shadow: none; }
  .paper tr, .paper-terms, .paper-sign { break-inside: avoid; }
  @page { margin: 16mm; }
}
/* Loading placeholder shown while a screen opens */
.page-skel { display: grid; grid-column: 1 / -1; align-content: start; gap: 14px; width: 100%; min-width: 0; padding: 2px; }
.page-skel i { display: block; height: 96px; border-radius: var(--radius-lg, 8px); background: linear-gradient(90deg, rgba(100, 112, 128, .13) 25%, rgba(100, 112, 128, .05) 50%, rgba(100, 112, 128, .13) 75%); background-size: 200% 100%; animation: skel-shimmer 1s linear infinite; }
.page-skel .sk-title { width: min(280px, 70%); height: 30px; }
.page-skel .sk-line { width: min(420px, 90%); height: 14px; }
.page-skel > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.page-skel .sk-block { height: 280px; }
@keyframes skel-shimmer { to { background-position: -200% 0; } }
@media (max-width: 760px) { .page-skel > div { grid-template-columns: minmax(0, 1fr); } .page-skel > div i { height: 68px; } }
.page-in > * { animation: page-in .3s ease-out both; }
@keyframes page-in { from { opacity: 0; } }
.xc { --xc-bar: #74492b; --xc-bar-hi: #593620; --xc-b2: #9aa1aa; --xc-b2-hi: #6f767f; --xc-grid: #e5e7e9; --xc-base: #a9aeb4; --xc-ink: #1c1e21; --xc-ink2: #53575e; --xc-hover: rgba(116, 73, 43, .08); }
.no-leaf .bid .bid-meta { display: none; }
@media (max-width: 760px) { .xc-ticks b, .xc-yaxis b, .xc-axisname { font-size: 12px; } }
@media print { .paper td { padding-block: 5px; } .paper-to { margin: 12px 0 14px; } .paper header { padding-bottom: 12px; } .paper-terms h3 { margin-top: 12px; } .paper-sign { margin-top: 30px; } .content > * + * { margin-top: 0; } }
.page-skel.is-flush { box-sizing: border-box; padding: 22px 24px; }
