/* Homebuilder frame — a build's Change orders tab (homes-change-orders.js).
   Narrow build pane / phone: the list, then the opened item in its place
   with a back button. Wide build pane (container >= 760px, see .hm-bd in
   homes-builds.css): list on the left, the open change order on the right.
   Suggestions from email are dashed and labelled "not counted". */

.hm-co-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.hm-co-detail { display: none; min-width: 0; }
.hm-co.is-reading .hm-co-list { display: none; }
.hm-co.is-reading .hm-co-detail { display: block; }
.hm-co-list { min-width: 0; }

.hm-co-tools { display: grid; gap: 10px; margin-bottom: 4px; }
.hm-co-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hm-co-tiles .hm-tile { padding: 10px 12px; }
.hm-co-tiles .hm-tile > b { font-size: 17px; }
.hm-co-add { display: flex; justify-content: flex-end; }
.hm-co-list .hm-empty .hm-btn { margin-top: 12px; }

/* ---- list rows ---- */
.hm-co-rows { display: grid; overflow: hidden; background: var(--app-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); }
.hm-co-row { display: grid; gap: 6px; width: 100%; min-height: 56px; padding: 11px 14px; font: inherit; text-align: left; color: inherit; background: none; border: 0; border-bottom: 1px solid var(--hm-line); cursor: pointer; }
.hm-co-row:last-child { border-bottom: 0; }
.hm-co-row:hover { background: var(--app-surface-2); }
.hm-co-row.is-selected { background: var(--app-accent-soft); box-shadow: inset 3px 0 0 var(--app-accent); }
.hm-co-row.is-void .hm-co-name, .hm-co-row.is-void .hm-co-amt { color: var(--hm-faint); text-decoration: line-through; }
.hm-co-row-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.hm-co-num { flex: none; font-size: 12px; font-weight: 700; color: var(--hm-muted); font-variant-numeric: tabular-nums; }
.hm-co-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--hm-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-co-amt { flex: none; font-size: 14px; font-weight: 650; color: var(--hm-ink); font-variant-numeric: tabular-nums; }
.hm-co-amt small { font-size: 11.5px; font-weight: 600; color: var(--app-ok); }
.hm-co-unpriced { font-size: 13px; font-weight: 500; color: var(--hm-faint); }
.hm-co-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--hm-muted); }
.hm-co-count { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.hm-co-count .hm-ic { width: 14px; height: 14px; }
.hm-co-when { color: var(--hm-faint); }
.hm-co-hint-tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--app-warn); }
.hm-co-hint-tag .hm-ic { width: 14px; height: 14px; }

/* ---- suggested from email (not counted) ---- */
.hm-co-suggested { margin-bottom: 4px; }
.hm-co-notcounted { margin-left: auto; font-size: 11px; font-weight: 650; letter-spacing: .03em; color: var(--hm-faint); }
.hm-co-sugg { display: grid; gap: 8px; margin-bottom: 8px; padding: 10px 12px; background: var(--hm-bg); border: 1.5px dashed var(--hm-line-strong); border-radius: var(--hm-radius); }
.hm-co-sugg.is-selected { border-color: var(--app-accent); background: var(--app-accent-soft); }
.hm-co-sugg-main { display: grid; gap: 4px; width: 100%; padding: 0; font: inherit; text-align: left; color: inherit; background: none; border: 0; cursor: pointer; }
.hm-co-sugg .hm-co-name { color: var(--hm-text); }
.hm-co-sugg .hm-co-amt { color: var(--hm-muted); }
.hm-co-sugg-acts { display: flex; gap: 6px; }

/* ---- detail ---- */
.hm-co-view { min-width: 0; }
.hm-co-back-row { margin: -4px 0 2px; }
.hm-co-head { padding-bottom: 6px; }
.hm-co-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hm-co-h { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.25; color: var(--app-navy); overflow-wrap: anywhere; }
.hm-co-desc { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--hm-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.hm-co-head .hm-facts { gap: 8px 24px; }
.hm-co-view > .hm-banner { margin: 12px 0 0; }
.hm-co-banner-acts { display: flex; flex: none; gap: 6px; }
.hm-co-hint { align-items: center; }
.hm-co-inline-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; font-weight: 600; color: var(--app-accent); text-decoration: none; }
.hm-co-inline-link:hover { text-decoration: underline; }
.hm-co-inline-link .hm-ic { width: 14px; height: 14px; }
.hm-co-inbudget { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; color: var(--app-ok); background: var(--app-ok-bg); border-radius: var(--hm-radius); }
.hm-co-inbudget .hm-ic { flex: none; width: 17px; height: 17px; margin-top: 1px; }
.hm-co-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 0; padding: 10px 0; border-top: 1px solid var(--hm-line); border-bottom: 1px solid var(--hm-line); }
.hm-co-hidden { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 13px; color: var(--hm-muted); }
.hm-co-hidden .hm-ic { flex: none; width: 15px; height: 15px; }

/* "How it moved": the hand-offs across inboxes, left to right. */
.hm-co-flow-wrap { display: grid; gap: 6px; margin: 0 0 14px; padding: 10px 12px; background: var(--app-surface-2); border-radius: var(--hm-radius); }
.hm-co-flow-k { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--hm-faint); }
.hm-co-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 0; padding: 0; list-style: none; }
.hm-co-flow-step { display: inline-flex; align-items: center; }
.hm-co-flow-name { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; font-size: 13px; font-weight: 600; color: var(--hm-ink); background: var(--app-surface); border: 1px solid var(--hm-line); border-radius: var(--radius-pill); white-space: nowrap; }
.hm-co-flow-name .hm-ic { width: 13px; height: 13px; color: var(--hm-muted); }
.hm-co-flow-step.is-inbox .hm-co-flow-name { color: var(--app-navy); background: var(--app-accent-soft); border-color: transparent; }
.hm-co-flow-step.is-inbox .hm-co-flow-name .hm-ic { color: var(--app-accent); }
.hm-co-flow-arrow { display: inline-flex; margin: 0 3px; color: var(--hm-faint); }
.hm-co-flow-arrow .hm-ic { width: 14px; height: 14px; }

/* Timeline: oldest first, one entry per email, on a rail. */
.hm-co-tl { position: relative; display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.hm-co-tl-item { position: relative; padding-left: 36px; }
.hm-co-tl-item::before { content: ""; position: absolute; left: 13px; top: 0; bottom: -12px; width: 2px; background: var(--hm-line); }
.hm-co-tl-item:first-child::before { top: 16px; }
.hm-co-tl-item:last-child::before { bottom: auto; height: 16px; }
.hm-co-tl-item:only-child::before { display: none; }
.hm-co-tl-node { position: absolute; left: 2px; top: 6px; display: grid; place-items: center; width: 24px; height: 24px; color: var(--hm-muted); background: var(--app-surface); border: 2px solid var(--hm-line-strong); border-radius: 50%; }
.hm-co-tl-node .hm-ic { width: 12px; height: 12px; }
.hm-co-tl-item.is-sent .hm-co-tl-node { color: var(--app-accent); border-color: var(--app-accent); }
.hm-co-tl-item.is-fwd .hm-co-tl-node { color: var(--app-warn); border-color: var(--app-warn); }

.hm-co-msg { min-width: 0; padding: 12px 14px; background: var(--app-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); }
.hm-co-msg.is-sent { background: var(--app-surface-2); }
.hm-co-msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.hm-co-msg-dir { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--hm-faint); }
.hm-co-msg.is-sent .hm-co-msg-dir { color: var(--app-accent); }
.hm-co-msg-dir .hm-ic { width: 13px; height: 13px; }
.hm-co-fwd { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; font-size: 11.5px; font-weight: 650; color: var(--app-warn); background: var(--app-warn-bg); border-radius: var(--radius-pill); }
.hm-co-fwd .hm-ic { width: 12px; height: 12px; }
.hm-co-msg-when { font-size: 12.5px; font-weight: 600; color: var(--hm-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hm-co-msg-from { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 6px 0 0; font-size: 14px; color: var(--hm-ink); overflow-wrap: anywhere; }
.hm-co-msg-from b { font-weight: 650; }
.hm-co-msg-addr { font-size: 12.5px; color: var(--hm-muted); }
.hm-co-role { padding: 0 7px; font-size: 11px; font-weight: 650; line-height: 1.6; color: var(--app-ok); background: var(--app-ok-bg); border-radius: var(--radius-pill); }
.hm-co-msg-to { margin: 2px 0 0; font-size: 12.5px; color: var(--hm-muted); overflow-wrap: anywhere; }
.hm-co-via { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 6px 0 0; }
.hm-co-via-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--app-navy); background: var(--app-accent-soft); border-radius: var(--radius-pill); white-space: nowrap; }
.hm-co-via-tag .hm-ic { width: 12px; height: 12px; color: var(--app-accent); }
.hm-co-attcount { display: flex; align-items: center; gap: 5px; margin: 8px 0 0; font-size: 12.5px; color: var(--hm-muted); }
.hm-co-attcount .hm-ic { width: 14px; height: 14px; }
.hm-co-msg-subj { margin: 6px 0 0; font-size: 13.5px; font-weight: 650; color: var(--hm-text); overflow-wrap: anywhere; }
.hm-co-msg-body { margin-top: 6px; }
.hm-co-msg-body > summary { display: grid; gap: 4px; list-style: none; cursor: pointer; }
.hm-co-msg-body > summary::-webkit-details-marker { display: none; }
.hm-co-msg-preview { font-size: 13.5px; line-height: 1.5; color: var(--hm-text); overflow-wrap: anywhere; }
.hm-co-more { font-size: 13px; font-weight: 600; color: var(--app-accent); }
.hm-co-more-close, .hm-co-msg-body[open] .hm-co-more-open, .hm-co-msg-body[open] .hm-co-msg-preview { display: none; }
.hm-co-msg-body[open] .hm-co-more-close { display: inline; }
.hm-co-msg-full { margin-top: 6px; font-size: 13.5px; line-height: 1.55; color: var(--hm-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.hm-co-msg-body[open] { display: flex; flex-direction: column-reverse; }
.hm-co-files { margin-top: 10px; }
.hm-co-msg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 13px; }
.hm-co-msg-foot .hm-co-inline-link { margin-left: 0; }
.hm-co-auto { font-size: 12px; color: var(--hm-faint); }
.hm-co-msg-foot .hm-btn-sm { min-height: 32px; }

/* history */
.hm-co-events { margin: 0; padding: 0; list-style: none; }
.hm-co-events li { position: relative; display: flex; align-items: baseline; gap: 10px; padding: 6px 0 6px 18px; font-size: 13px; color: var(--hm-text); }
.hm-co-events li::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: var(--hm-line); }
.hm-co-events li:first-child::before { top: 12px; }
.hm-co-events li:last-child::before { bottom: calc(100% - 12px); }
.hm-co-ev-dot { position: absolute; left: 1px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--hm-line-strong); }
.hm-co-ev-main { flex: 1; min-width: 0; }
.hm-co-ev-main span { color: var(--hm-muted); }
.hm-co-ev-main q { display: block; margin-top: 2px; color: var(--hm-muted); font-style: italic; }
.hm-co-events time { flex: none; font-size: 12px; color: var(--hm-faint); font-variant-numeric: tabular-nums; }

/* link-an-email picker (sheet) */
.hm-co-pick { margin-top: 4px; }
.hm-co-pick-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--hm-line); }
.hm-co-pick-row:last-child { border-bottom: 0; }
.hm-co-pick-main { display: grid; flex: 1; gap: 2px; min-width: 0; font-size: 13.5px; }
.hm-co-pick-main b { color: var(--hm-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-co-pick-main small { color: var(--hm-muted); }
.hm-co-pick-main span { color: var(--hm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-co-pick-row .hm-btn, .hm-co-pick-row .hm-pill { flex: none; }

/* Phone: attachments are one horizontal scrolling row. */
@container (max-width: 639px) {
  .hm-co-files { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -14px; padding-right: 14px; }
  .hm-co-files::-webkit-scrollbar { display: none; }
  .hm-co-files .hm-file-link { flex: none; max-width: 240px; }
  .hm-co-hint { flex-wrap: wrap; }
  .hm-co-hint > .hm-btn { margin-left: 27px; }
  .hm-co-suggest-banner { flex-wrap: wrap; }
  .hm-co-banner-acts { margin-left: 27px; }
  .hm-co-tl-item { padding-left: 32px; }
  .hm-co-tl-item::before { left: 11px; }
  .hm-co-tl-node { left: 0; }
  .hm-co-msg { padding: 11px 12px; }
}

/* Wide build pane: list beside the open change order. */
@container (min-width: 760px) {
  .hm-co-split { grid-template-columns: minmax(270px, 320px) minmax(0, 1fr); gap: 22px; align-items: start; }
  .hm-co-detail, .hm-co.is-reading .hm-co-detail { display: block; }
  .hm-co.is-reading .hm-co-list { display: block; }
  .hm-co-list { position: sticky; top: 8px; }
  .hm-co-back-row { display: none; }
  .hm-co-tiles { grid-template-columns: 1fr 1fr; }
  .hm-co-placeholder .hm-empty { margin-top: 24px; }
  .hm-co.is-empty .hm-co-split { grid-template-columns: minmax(0, 1fr); }
  .hm-co.is-empty .hm-co-detail { display: none; }
}

/* Homeowner in the build header (homes-build-detail.js). */
.hm-ho dd { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.hm-ho-name { font-weight: 600; color: var(--hm-ink); }
.hm-ho-contact { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; font-weight: 500; }
.hm-ho-contact a { color: var(--app-accent); text-decoration: none; overflow-wrap: anywhere; }
.hm-ho-contact a:hover { text-decoration: underline; }
.hm-ho .hm-btn-sm { min-height: 30px; padding: 3px 9px; }
.hm-ho-hint { flex-basis: 100%; font-size: 12px; font-weight: 500; color: var(--hm-muted); }
.hm-ho.is-empty dd { gap: 4px 10px; }

/* Pricing method in the build header (homes-build-detail.js). */
.hm-pricing dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.hm-pricing dt label { cursor: pointer; }
.hm-pricing .hm-select-sm { min-height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 13.5px; font-weight: 550; }
.hm-pricing .hm-btn-sm { min-height: 30px; padding: 3px 9px; }
