/* Offer requests, comparison and award, change orders (staff screens). MSE Ops tokens and rules. */

.block { display: block; }
.row-gap.end { justify-content: flex-end; margin-top: 12px; }

/* Pick lists in drawers: a checkbox or a button per row, 44 px tall. */
.pick-list { display: grid; gap: 2px; max-height: 56vh; overflow: auto; border: 1px solid var(--card-edge); border-radius: 12px; padding: 4px; background: var(--work); }
.pick { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; min-height: 44px; padding: 6px 10px; border-radius: 8px; cursor: pointer;
  border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; width: 100%; }
.pick:hover { background: oklch(from var(--blue) l c h / .08); }
.pick input { width: 18px; height: 18px; accent-color: var(--fill-blue); }
.pick .mono { color: var(--text-3); font-size: 12px; }
button.pick { grid-template-columns: auto 1fr auto; }
details.add-new { border-top: 1px solid var(--rule); padding-top: 10px; }
details.add-new summary { cursor: pointer; color: var(--blue-ink); font-size: var(--fs-sm); min-height: 32px; }
details.add-new .form-grid { margin-top: 10px; }

/* The comparison: lines down, contractors across. Numbers right-aligned in Geist Mono. */
.compare-wrap { max-height: 70vh; }
table.compare th.num, table.compare td.num { min-width: 140px; }
table.compare td.cmp { vertical-align: top; }
table.compare td.cmp .pill { margin-top: 4px; }
table.compare td.cmp.excluded .filled, table.compare td.cmp.blank .filled { color: var(--text-3); font-style: italic; }
table.compare .qty-flag, .cmp-cards .qty-flag { display: block; margin: 4px 0 0; color: var(--text-2); font-family: "Inter", system-ui, sans-serif; font-size: var(--fs-xs); white-space: normal; text-align: left; }
.qty-flag b.mono { color: var(--brass-ink); font-size: 12px; }
table.compare tfoot th, table.compare tfoot td { border-top: 1px solid var(--rule); font-size: var(--fs-sm); color: var(--text-2); background: var(--card-solid); }
table.compare tfoot tr.strong th, table.compare tfoot tr.strong td { color: var(--text); font-weight: 650; border-top: 2px solid var(--rule); }
table.compare td { white-space: normal; }
.extras { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 10px; display: grid; gap: 8px; }
.extras h3 { font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.extra { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Question threads */
.thread { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.thread li { padding: 10px 14px; border-radius: 14px; background: var(--work-2); max-width: 88%; }
.thread li.mine { justify-self: end; background: oklch(from var(--blue) l c h / .10); }
.thread .meta { display: flex; gap: 10px; align-items: center; font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 4px; flex-wrap: wrap; }
.thread .meta b { color: var(--text-2); }
.thread p { white-space: pre-wrap; }
.answer { display: grid; gap: 8px; }
.answer textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--card-edge); background: var(--field); color: var(--text); font: inherit; }

/* Change order pricing */
.co-rows { display: grid; gap: 10px; }
.co-row { border: 1px solid var(--card-edge); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; background: var(--card-solid); }
.co-row.view { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.co-what { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.co-what .mono { color: var(--text-3); font-size: 12px; }
.co-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 0 12px; align-items: end; }
.co-fields.new { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.co-fields .field { margin-bottom: 0; }
.co-fields > .btn { margin-bottom: 2px; }
.co-total { display: flex; justify-content: flex-end; gap: 16px; align-items: baseline; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); }
.co-total span { color: var(--text-2); }
.co-total b { font-size: var(--fs-xl); }
.filelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.filelist li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }

@media (max-width: 640px) {
  .co-fields, .co-fields.new { grid-template-columns: 1fr; }
  .thread li { max-width: 100%; }
  .pick { grid-template-columns: auto 1fr; }
  .pick small { grid-column: 2; }
}

/* ---- Review fixes (REVIEW-2: M4 header, M11 compare, M12 contractors, B3 phone compare; exceed 1) ---- */

/* Record pages (offer request, change order): the ref and status sit top right, the actions under them. */
.sheet.cb-rec .page-head .tags { margin-left: auto; flex-direction: row; align-items: center; justify-content: flex-end; }
.sheet.cb-rec .page-head .tags > .refbox { order: 2; }
.sheet.cb-rec .page-head .actions { justify-content: flex-end; }
.sheet.cb-rec.no-panel { padding-bottom: 28px; }
@media (max-width: 640px) {
  .sheet.cb-rec .page-head .tags { margin-left: 0; align-items: flex-start; justify-content: flex-start; flex-direction: column-reverse; width: 100%; }
  .sheet.cb-rec .page-head .tags > .refbox { order: 0; }
  .sheet.cb-rec .page-head .refbox { justify-items: start; }
  .sheet.cb-rec .page-head .actions { justify-content: flex-start; }
}

/* Contractors tab: name above contact, and one "more" menu per row. */
.who-cell { display: grid; gap: 2px; min-width: 0; }
.who-cell small { overflow-wrap: anywhere; }
.row-acts { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-menu-wrap { position: relative; }
.row-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 210px; padding: 6px; border-radius: 12px; display: grid; gap: 2px;
  border: 1px solid var(--glass-edge); box-shadow: var(--e-3); background: var(--card-solid); }
.row-menu button { display: flex; gap: 10px; align-items: center; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; text-align: left; }
.row-menu button:hover, .row-menu button:focus-visible { background: oklch(from var(--blue) l c h / .10); }
.icon-btn.more { width: 36px; height: 36px; }

/* Compare: the item column takes the room, money columns stay a sensible width, totals sit under their columns. */
table.compare { table-layout: fixed; width: 100%; min-width: 640px; }
table.compare col.c-pick { width: 44px; }
table.compare col.c-num { width: 170px; }
table.compare col.c-item { width: auto; }
table.compare th.num, table.compare td.num { min-width: 0; }
table.compare td.item { white-space: normal; }
table.compare .cv { display: grid; gap: 2px; justify-items: end; }
table.compare td.item .cv { justify-items: start; display: block; }
.cmp-amt { display: inline-flex; align-items: center; gap: 6px; font-family: "Geist Mono", ui-monospace, monospace; }
.cmp-sub { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.cmp-note { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--text-2); white-space: normal; text-align: left; }
i.cheapest { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; flex: none; }
.delta { font-family: "Geist Mono", ui-monospace, monospace; font-size: 11px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.delta.up { color: var(--coral-ink); }
.delta.down { color: var(--good-ink); }
.cmp-head { display: grid; gap: 2px; justify-items: end; text-transform: none; letter-spacing: 0; }
.cmp-head b { color: var(--text); font-family: "Inter", system-ui, sans-serif; font-size: var(--fs-sm); font-weight: 650; white-space: normal; text-align: right; }
.cmp-head small { font-family: "Inter", system-ui, sans-serif; }
.cmp-head small { font-weight: 500; font-size: 11px; }
.best { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--good-ink);
  background: oklch(from var(--good) l c h / .14); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
table.compare th.offer-col.is-best { box-shadow: inset 0 3px 0 var(--good); }
table.compare tfoot { position: sticky; bottom: 0; z-index: 2; }
table.compare tfoot td.num { font-family: "Geist Mono", ui-monospace, monospace; }
table.compare tfoot td.num .delta { display: block; }
table.compare td.pick-col, table.compare th.pick-col { text-align: center; }
table.compare td.pick-col input { width: 20px; height: 20px; accent-color: var(--fill-blue); }

/* Phone compare: one card per line, the estimate and each offer stacked; totals in a card that stays in view. */
.cmp-cards, .cmp-sticky { display: none; }
@media (max-width: 760px) {
  .compare-wrap { display: none; }
  .cmp-cards { display: grid; gap: 10px; }
  .cmp-card { border: 1px solid var(--card-edge); border-radius: 14px; padding: 12px 14px; background: var(--card-solid); display: grid; gap: 8px; }
  .cmp-card header { display: flex; gap: 10px; align-items: flex-start; }
  .cmp-card header input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--fill-blue); flex: none; }
  .cmp-card header > div { display: grid; gap: 2px; min-width: 0; }
  .cmp-card header .mono { color: var(--text-3); font-size: 12px; }
  .cmp-rows { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin: 0; }
  .cmp-rows dt { color: var(--text-2); font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
  .cmp-rows dd { margin: 0; display: grid; justify-items: end; gap: 2px; text-align: right; font-family: "Geist Mono", ui-monospace, monospace; }
  .cmp-rows dd.full { grid-column: 1 / -1; display: block; text-align: left; font-family: "Inter", system-ui, sans-serif; margin-top: -2px; padding-bottom: 4px; border-bottom: 1px dashed var(--rule); }
  .cmp-cards .cmp-rows dd.full .qty-flag, .cmp-cards .cmp-rows dd.full .cmp-note { text-align: left; }
  .cmp-sticky { box-shadow: 0 -10px 30px -18px oklch(0 0 0 / .45); }
  .cmp-rows dd.excluded .cmp-amt, .cmp-rows dd.blank .cmp-amt { color: var(--text-3); font-style: italic; }
  .cmp-sticky { display: grid; gap: 6px; position: sticky; bottom: 8px; z-index: 5; margin-top: 12px; padding: 12px 14px; border-radius: 14px;
    background: var(--card-solid); border: 1px solid var(--card-edge); box-shadow: var(--e-3); }
  .cmp-sticky h3 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 650; }
  .cmp-sticky dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin: 0; }
  .cmp-sticky dt { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); min-width: 0; }
  .cmp-sticky dd { margin: 0; text-align: right; font-family: "Geist Mono", ui-monospace, monospace; display: grid; justify-items: end; }
}
