/* ─────────────────────────────────────────────────────────────────────────────
 * A figure with its unit (`.pbx-affix`: "£ 12.00", "12 %") and a client's or a visit's
 * own prices (`.pe`). The parts-and-hours price builder this file was named for went
 * the evening of 2026-09-29 (docs/features/2026-09-29-repair-price-list-plan.md,
 * decision 15): every price is Materials £ + Labour £.
 * ───────────────────────────────────────────────────────────────────────────── */
.pbx-affix {
  --pbx-ink-4: var(--ink-4, #9a9188);
  --pbx-rule-strong: var(--rule-strong, rgba(26, 24, 21, 0.14));
  --pbx-card: var(--surface-card, #fff);
  --pbx-subtle: var(--surface-subtle, #f2efe9);
}
.pbx-affix { display: flex; align-items: stretch; border: 1px solid var(--pbx-rule-strong); border-radius: 8px; background: var(--pbx-card); height: 38px; min-width: 0; box-sizing: border-box; }
.pbx-affix > span { display: grid; place-items: center; padding: 0 8px; color: var(--pbx-ink-4); font-size: 13px; background: var(--pbx-subtle); border-right: 1px solid var(--pbx-rule-strong); border-radius: 8px 0 0 8px; white-space: nowrap; }
.pbx-affix > span.pbx-per { border-right: 0; border-left: 1px solid var(--pbx-rule-strong); border-radius: 0 8px 8px 0; }
/* The unit follows the figure in the markup ("12 %"), so no reordering here. */
.pbx-affix--suffix > span { border-right: 0; border-left: 1px solid var(--pbx-rule-strong); border-radius: 0 8px 8px 0; }
.pbx-affix:focus-within { outline: 2px solid var(--accent, #c49510); outline-offset: 1px; }

/* ─────────────────────────────────────────────────────────────────────────────
 * A client's or a visit's own prices (features/pricing-exceptions.js), in the
 * Edit Client modal and the visit's Follow-up panel — "their price list", the
 * owner's choice of three directions (2026-09-28): rates and terms as boxes beside
 * the usual figure, then every repair with the usual price and theirs, then the
 * inspection-quote rates. A figure that differs is outlined in the scope's tone,
 * blue for a client and gold for a visit. White ground, no grey panels.
 * The side panel (.pe-sheet) is where a special price is built.
 * ───────────────────────────────────────────────────────────────────────────── */
.pe,
.pe-sheet {
  --pbx-ink: var(--ink, #1a1815);
  --pbx-ink-2: var(--ink-2, #3d3a34);
  --pbx-ink-3: var(--ink-3, #6b6458);
  --pbx-ink-4: var(--ink-4, #9a9188);
  --pbx-rule: var(--rule, rgba(26, 24, 21, 0.08));
  --pbx-rule-strong: var(--rule-strong, rgba(26, 24, 21, 0.14));
  --pbx-card: var(--surface-card, #fff);
  --pbx-subtle: var(--surface-subtle, #f2efe9);
  --pe-tone: var(--info, #2563a8);
  --pe-tone-soft: var(--info-soft, rgba(37, 99, 168, 0.1));
  color: var(--pbx-ink);
}
.pe[data-pe-scope="visit"] { --pe-tone: var(--accent-ink, #7a5c05); --pe-tone-soft: var(--accent-soft, rgba(196, 149, 16, 0.12)); }
/* The list lays itself out by its OWN width: the Edit Client pane is ~600px on a wide screen. */
.pe { display: grid; gap: 24px; min-width: 0; container: pe / inline-size; }
.pe-lead { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--pbx-ink-2); }
.pe-count { display: inline-flex; margin-left: 8px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--pe-tone); background: var(--pe-tone-soft); white-space: nowrap; vertical-align: 1px; }
.pe-sec { display: grid; gap: 12px; min-width: 0; }
.pe-sec__h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 14px; padding-bottom: 8px; border-bottom: 1px solid var(--pbx-rule-strong); }
.pe-sec__h h4 { margin: 0; font-family: var(--font-display, "Space Grotesk", sans-serif); font-size: 15px; font-weight: 600; }
.pe-sec__h span { font-size: 12.5px; color: var(--pbx-ink-3); }
.pe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px 18px; }
.pe-field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.pe-field--one { max-width: 220px; }
.pe-field--wide { max-width: 560px; }
.pe-label { font-size: 12.5px; font-weight: 600; color: var(--pbx-ink-2); }
.pe-usual { font-size: 12px; color: var(--pbx-ink-4); font-variant-numeric: tabular-nums; }
.pe .pbx-affix input,
.pe-sheet .pbx-affix input { border: 0; background: none; padding: 0 8px; width: 100%; min-width: 0; outline: none; font: inherit; font-size: 13.5px; color: var(--pbx-ink); height: auto; box-shadow: none; text-align: right; font-variant-numeric: tabular-nums; }
.pe-field.is-set .pbx-affix,
.pe-rep.is-set .pe-rep__theirs .pbx-affix { border-color: var(--pe-tone); box-shadow: 0 0 0 1px var(--pe-tone); }
.pe-text { height: 38px; border: 1px solid var(--pbx-rule-strong); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13.5px; min-width: 0; width: 100%; box-sizing: border-box; background: var(--pbx-card); color: var(--pbx-ink); }
.pe-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.pe-search { flex: 1 1 240px; min-width: 0; max-width: 360px; }
.pe-search input { width: 100%; box-sizing: border-box; height: 38px; border: 1px solid var(--pbx-rule-strong); border-radius: 8px; padding: 0 10px 0 34px; font: inherit; font-size: 13.5px; color: var(--pbx-ink); background: var(--pbx-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239a9188' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E") no-repeat 11px center / 14px; }
.pe-seg { display: inline-flex; border: 1px solid var(--pbx-rule-strong); border-radius: 8px; overflow: hidden; }
.pe-seg__btn { border: 0; background: var(--pbx-card); padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--pbx-ink-2); white-space: nowrap; }
.pe-seg__btn + .pe-seg__btn { border-left: 1px solid var(--pbx-rule-strong); }
.pe-seg__btn[aria-pressed="true"] { background: var(--pbx-ink); color: #fff; }
.pe-head,
.pe-rep { display: grid; grid-template-columns: minmax(0, 1fr) 96px 176px 136px; gap: 12px; align-items: center; }
.pe-head { padding: 2px 0 8px; border-bottom: 1px solid var(--pbx-rule-strong); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--pbx-ink-3); }
.pe-head span:nth-child(2),
.pe-head span:nth-child(3) { text-align: right; }
.pe-rep { padding: 8px 0; border-bottom: 1px solid var(--pbx-rule); }
.pe-rep__name { min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.pe-rep__was { display: none; }
.pe-rep__usual { text-align: right; font-size: 13px; color: var(--pbx-ink-4); font-variant-numeric: tabular-nums; }
.pe-built { display: grid; justify-items: end; gap: 1px; min-width: 0; }
.pe-built__fig { font-size: 14.5px; font-weight: 600; color: var(--pe-tone); font-variant-numeric: tabular-nums; }
.pe-built__how { font-size: 11.5px; color: var(--pbx-ink-3); text-align: right; overflow-wrap: anywhere; }
.pe-rep__acts { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
/* A client's or a visit's special price (the evening of 2026-09-29): the fixes grouped by
   door part, each special price shown as its total over Materials · Labour, edited in the
   side panel as two boxes with "Usually" beside each. */
.pe-part { margin: 12px 0 0; padding: 0 0 6px; border-bottom: 1px solid var(--pbx-rule-strong); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--pbx-ink-3); }
.pe-part:first-child { margin-top: 4px; }
.pe-rep__theirs { display: grid; justify-items: end; gap: 1px; min-width: 0; text-align: right; }
.pe-rep__fig { font-size: 14.5px; font-weight: 600; color: var(--pe-tone); font-variant-numeric: tabular-nums; }
.pe-rep__how { font-size: 11.5px; color: var(--pbx-ink-3); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pe-rep__none { color: var(--pbx-ink-4); }
.pe-sums { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.pe-sums .pe-field--one { flex: 1 1 160px; max-width: 220px; }
.pe-sheet__total { margin: 0; font-size: 14px; color: var(--pbx-ink-2); }
.pe-sheet__total b { font-size: 16px; color: var(--pbx-ink); font-variant-numeric: tabular-nums; }
.pe-sheet__error { margin: 0; font-size: 13px; color: var(--pbx-danger, #b03030); }
.pe-x { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--pbx-ink-4); font-size: 17px; line-height: 1; cursor: pointer; }
.pe-x:hover { background: var(--pbx-subtle); color: var(--pbx-ink); }
.pe-empty { margin: 0; padding: 14px 0; font-size: 13.5px; color: var(--pbx-ink-3); }
.pe-link { border: 0; background: none; padding: 0; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--pbx-accent-ink, #7a5c05); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.pe-more { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 14px; width: 100%; padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--pbx-rule-strong); background: none; font: inherit; color: var(--pbx-ink); text-align: left; cursor: pointer; }
.pe-more__t { font-family: var(--font-display, "Space Grotesk", sans-serif); font-size: 15px; font-weight: 600; }
.pe-more__t::after { content: " \25BE"; font-size: 12px; color: var(--pbx-ink-4); }
.pe-more[aria-expanded="true"] .pe-more__t::after { content: " \25B4"; }
.pe-more__s { font-size: 12.5px; color: var(--pbx-ink-3); }
.pe-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
/* The side panel. Fixed over the page, or over the Edit Client window it lives in. */
.pe-sheet { position: fixed; inset: 0; z-index: 1300; }
.pe-sheet__back { position: absolute; inset: 0; border: 0; background: rgba(26, 24, 21, 0.32); cursor: default; }
.pe-sheet__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(680px, 100%); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--pbx-card); box-shadow: -20px 0 44px rgba(26, 24, 21, 0.18); }
.pe-sheet__h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--pbx-rule); }
.pe-sheet__eyebrow { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pbx-accent-ink, #7a5c05); }
.pe-sheet__h h3 { margin: 0; font-family: var(--font-display, "Space Grotesk", sans-serif); font-size: 18px; font-weight: 600; }
.pe-sheet__sub { margin: 4px 0 0; font-size: 13px; color: var(--pbx-ink-3); }
.pe-sheet__b { display: grid; gap: 18px; align-content: start; min-height: 0; padding: 18px 22px 24px; overflow-y: auto; }
.pe-sheet__f { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--pbx-rule); }
.pe-sheet__acts { display: flex; flex-wrap: wrap; gap: 8px; }
@container pe (max-width: 640px) {
  .pe-head { display: none; }
  .pe-rep { grid-template-columns: minmax(0, 1fr) 176px; row-gap: 6px; align-items: start; }
  .pe-rep__name { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .pe-rep__was { display: block; margin-top: 2px; font-size: 12px; color: var(--pbx-ink-4); }
  .pe-rep__usual { display: none; }
  .pe-rep__theirs { grid-column: 2; grid-row: 1; }
  .pe-rep__acts { grid-column: 2; grid-row: 2; }
  .pe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pe-search { flex-basis: 100%; max-width: none; }
}
@container pe (max-width: 380px) {
  .pe-grid { grid-template-columns: minmax(0, 1fr); }
  .pe-rep { grid-template-columns: minmax(0, 1fr) 140px; }
}
@media (max-width: 900px) {
  .pe .pbx-affix, .pe-sheet .pbx-affix, .pe-text, .pe-search input { height: 44px; }
  /* 16px stops iOS zooming into a field on focus. */
  .pe .pbx-affix input, .pe-sheet .pbx-affix input, .pe-text, .pe-search input { font-size: 16px; }
  .pe-seg__btn, .pe-rep__acts .btn { min-height: 44px; }
  .pe-x { width: 44px; height: 44px; }
  .pe-sheet__panel { width: 100%; }
  .pe-sheet__h, .pe-sheet__b, .pe-sheet__f { padding-left: 16px; padding-right: 16px; }
}
