/* RackApp prototype · client portal (F10), drawn inside the shell's browser frame.
   Fluid: a top bar, a side nav that becomes a tab row on narrow frames, and content that wraps below it.
   Layout adapts to the frame, not the window: container queries on .pt (frame width) and .pt-main
   (content width), with plain flex-wrap underneath as the fallback. Every colour is a base.css token;
   green / amber / red appear only as damage classes or due-date tones, always with a shape or icon and words. */

.pt {
  container: pt / inline-size;
  width: 100%; min-height: 100%; display: flex; flex-direction: column;
  background: var(--app-bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  overflow-wrap: break-word; overflow-x: clip;
  --pt-pad: 24px;
  /* Ink for counts printed inside heat cells, chosen per theme by the cell's luminance. */
  --pt-heat-ink-2: var(--heat-ink-dark);
  --pt-heat-ink-3: var(--heat-ink-light);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pt { --pt-heat-ink-2: var(--heat-ink-light); --pt-heat-ink-3: var(--heat-ink-dark); }
}
:root[data-theme="dark"] .pt { --pt-heat-ink-2: var(--heat-ink-light); --pt-heat-ink-3: var(--heat-ink-dark); }
.pt *, .pt *::before, .pt *::after { box-sizing: border-box; }
.pt p { margin: 0; }

/* ---------- top bar ---------- */
.pt-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 10px var(--pt-pad); background: var(--appbar); border-bottom: var(--bw) solid var(--line); }
.pt-brand { display: flex; align-items: center; gap: 10px; flex: 1 1 220px; min-width: 0; }
.pt-brand > svg { flex: none; }
.pt-brand-text { display: flex; flex-direction: column; min-width: 0; }
.pt-brand-name { font-weight: 700; font-size: 17px; line-height: 1.2; }
.pt-brand-sub { font-size: 13px; color: var(--ink-3); }
.pt-site { display: flex; align-items: center; gap: 10px; flex: 0 1 340px; min-width: 0; }
.pt-site .pt-label { flex: none; }
.pt-site .select { min-height: 44px; padding-top: 8px; padding-bottom: 8px; font-weight: 600; }
.pt-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pt-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pt-user-name { font-weight: 600; font-size: 15px; }
.pt-user-role { font-size: 13px; color: var(--ink-3); }

/* ---------- body: side nav + content ---------- */
.pt-body { display: flex; flex-wrap: wrap; align-items: stretch; flex: 1 0 auto; }
.pt-nav { flex: 1 1 220px; padding: 16px 12px; background: var(--surface); border-right: var(--bw) solid var(--line); }
.pt-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pt-nav-li { min-width: 0; }
.pt-nav-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 15.5px; line-height: 1.2; text-align: left; }
.pt-nav-item:hover { background: var(--surface-2); color: var(--ink); }
.pt-nav-item.pt-is-on { background: var(--accent-soft); color: var(--accent); }
.pt-nav-item .ico { flex: none; }
.pt-nav-label { min-width: 0; hyphens: auto; }
.pt-nav-badge { margin-left: auto; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; font-weight: 700; display: inline-grid; place-items: center; }
.pt-nav-item.pt-is-on .pt-nav-badge { background: var(--accent); color: var(--accent-ink); }
.pt-main { container: ptmain / inline-size; flex: 999 1 560px; min-width: 0; padding: 24px var(--pt-pad) 40px; display: flex; flex-direction: column; }

@container pt (width < 820px) {
  .pt-top, .pt-main { --pt-pad: 16px; }
  .pt-nav { flex-basis: 100%; padding: 6px 8px 0; border-right: 0; border-bottom: var(--bw) solid var(--line); }
  .pt-nav-list { flex-direction: row; gap: 2px; }
  .pt-nav-li { flex: 1 1 0; }
  .pt-nav-item { flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 2px 8px; border-radius: 10px 10px 0 0; font-size: 12.5px; text-align: center; text-wrap: balance; }
  .pt-nav-item.pt-is-on { box-shadow: inset 0 -3px 0 var(--accent); }
  .pt-nav-badge { position: absolute; top: 3px; left: calc(50% + 8px); min-width: 20px; height: 20px; padding: 0 6px; font-size: 11.5px; }
  /* A worded badge ("Due") does not fit a phone tab: show a dot; the word stays for screen readers. */
  .pt-nav-badge--text { top: 6px; left: calc(50% + 10px); width: 10px; min-width: 0; height: 10px; padding: 0; font-size: 0; overflow: hidden; background: var(--accent); }
}
@container pt (width < 640px) {
  .pt-brand { order: 1; }
  .pt-user { order: 2; }
  .pt-site { order: 3; flex: 1 1 100%; }
  .pt-user-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}

/* ---------- page scaffolding ---------- */
.pt-page { width: 100%; max-width: 1280px; display: flex; flex-direction: column; gap: 20px; }
.pt-page--mid { max-width: 980px; }
.pt-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.pt-head-text { min-width: 0; flex: 1 1 320px; }
.pt-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.pt-h1 { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1.05; letter-spacing: 0.005em; overflow-wrap: anywhere; }
.pt-sub { margin-top: 4px; font-size: 15.5px; color: var(--ink-2); max-width: 72ch; }
.pt-h2 { font-size: 18px; font-weight: 700; line-height: 1.25; }
.pt-h3 { font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--ink-2); }
.pt-panel { gap: 14px; min-width: 0; }
.pt-label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.pt-tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.pt-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 7px; border-radius: 999px; border: var(--bw) solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.pt-status .ico { flex: none; }
.pt-empty { display: flex; align-items: center; gap: 10px; padding: 18px; border: var(--bw) dashed var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--ink-2); }
.pt-empty .ico { flex: none; color: var(--ink-3); }
.pt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pt-btn { min-height: 44px; padding: 0 14px; border-radius: 10px; font-size: 15px; }
.pt-icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); }
.pt-icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.pt-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.pt-link:hover { color: var(--accent-strong); }
.pt-live { font-size: 14px; color: var(--ink-2); }
.pt-live:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.pt-mono { font-family: var(--font-mono); }
.pt-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- facts (definition lists) ---------- */
.pt-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px 20px; }
.pt-fact { min-width: 0; }
.pt-fact dt { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.pt-fact dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.pt-fact-sub { display: block; font-size: 14px; font-weight: 500; color: var(--ink-2); }

/* ---------- overview ---------- */
.pt-sitehead { gap: 16px; }
.pt-sitehead .pt-head-text { flex: none; }
.pt [tabindex="-1"]:focus { outline: none; }
.pt-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@container ptmain (width >= 620px) { .pt-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pt-kpi { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 44px; padding: 14px 16px; background: var(--surface); border: var(--bw) solid var(--line); border-radius: 14px; color: inherit; font: inherit; text-align: left; }
button.pt-kpi { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
button.pt-kpi:hover { border-color: var(--accent-line); box-shadow: var(--shadow-1); }
.pt-kpi-label { display: flex; align-items: center; gap: 7px; padding-right: 22px; font-size: 14px; font-weight: 600; line-height: 1.25; color: var(--ink-2); }
.pt-kpi-label svg { flex: none; }
.pt-kpi-value { font-family: var(--font-body); font-weight: 600; font-size: 34px; line-height: 1.1; color: var(--ink); }
.pt-kpi-value--text { font-size: 22px; line-height: 1.25; padding: 4px 0 3px; }
.pt-kpi-note { font-size: 13.5px; line-height: 1.35; color: var(--ink-3); }
.pt-kpi-go { position: absolute; top: 13px; right: 12px; color: var(--ink-3); }
.pt-ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 16px; align-items: start; }
.pt-ov-wide { grid-column: 1 / -1; }

/* red alerts reach the client before the report is signed */
.pt-alerts .banner-ico { margin-top: 2px; }
.pt-alerts-title { font-size: 17px; }
.pt-alert-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.pt-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: var(--bw) solid var(--red-line); }
.pt-alert > svg { flex: none; }
.pt-alert-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.pt-alert-sub { font-size: 14px; color: var(--ink-2); }
.pt-alert-note { font-size: 13.5px; color: var(--ink-3); }
.pt-alert-do { margin-top: 10px; font-size: 14.5px; color: var(--ink-2); }
.pt-alert-do b { color: var(--ink); }

/* reminders */
.pt-rems { list-style: none; margin: 0; padding: 0; border: var(--bw) solid var(--line); border-radius: 14px; overflow: hidden; }
.pt-rem { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border: 0; border-bottom: var(--bw) solid var(--line); background: transparent; color: inherit; font: inherit; text-align: left; }
.pt-rems > li:last-child > .pt-rem { border-bottom: 0; }
button.pt-rem { cursor: pointer; }
button.pt-rem:hover { background: var(--surface-2); }
.pt-rem:focus-visible { outline-offset: -3px; }
.pt-rem-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.pt-rem-ico--red { background: var(--red-soft); color: var(--red); }
.pt-rem-ico--amber { background: var(--amber-soft); color: var(--amber); }
.pt-rem-ico--accent { background: var(--accent-soft); color: var(--accent); }
.pt-rem-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pt-rem-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; }
.pt-rem-sub { font-size: 14px; color: var(--ink-2); }
.pt-rem-chev { flex: none; color: var(--ink-3); }

/* ---------- charts ---------- */
.pt-fig { margin: 0; gap: 14px; min-width: 0; }
.pt-fig-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.pt-fig-titles { flex: 1 1 240px; min-width: 0; }
.pt-fig-sub { margin-top: 3px; font-size: 14px; color: var(--ink-3); }
.pt-seg { flex: none; }
.pt-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-2); }
.pt-legend li { display: inline-flex; align-items: center; gap: 6px; }

/* stacked columns: 24 px marks, 4 px rounded data-end, 2 px surface gap between segments */
.pt-cols { padding: 28px 0 0 30px; }
.pt-cols-plot { position: relative; height: 200px; display: flex; border-bottom: 1px solid var(--line-strong); }
.pt-gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); pointer-events: none; }
.pt-gridlabel { position: absolute; right: calc(100% + 8px); top: -9px; font-size: 12px; line-height: 18px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pt-gridlabel--0 { top: auto; bottom: -9px; right: calc(100% + 8px); }
.pt-col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 8px; outline-offset: -3px; }
.pt-stack { position: relative; width: 24px; display: flex; flex-direction: column-reverse; gap: 2px; transition: opacity 0.15s; }
.pt-stack > span { display: block; flex: 1 1 0; min-height: 2px; }
.pt-stack > span:last-of-type { border-radius: 4px 4px 0 0; }
.pt-mark--red { background: var(--red-fill); }
.pt-mark--amber { background: var(--amber-fill); }
.pt-mark--green { background: var(--green-fill); }
.pt-col-total { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 700; line-height: 1.2; color: var(--ink); white-space: nowrap; }
.pt-cols.pt-has-hot .pt-col:not(.pt-is-hot) .pt-stack { opacity: 0.4; }
.pt-cols-x { display: flex; margin-top: 8px; }
.pt-xl { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12.5px; line-height: 1.3; color: var(--ink-3); text-align: center; }
.pt-xl b { font-size: 14px; color: var(--ink); }
.pt-draft-note { font-size: 13.5px; color: var(--ink-3); }

/* tooltip: enhances, never gates (the table view has every value) */
.pt-tip { position: absolute; z-index: 6; bottom: calc(100% + 30px); width: max-content; max-width: 250px; padding: 10px 12px; border: var(--bw) solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); font-size: 13.5px; font-weight: 400; line-height: 1.35; text-align: left; pointer-events: none; }
.pt-tip--center { left: 50%; transform: translateX(-50%); }
.pt-tip--start { left: -8px; }
.pt-tip--end { right: -8px; }
.pt-tip-head { font-size: 12.5px; color: var(--ink-3); }
.pt-tip-val { font-size: 16px; font-weight: 700; }
.pt-tip-rows { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.pt-tip-rows li { display: flex; align-items: center; gap: 7px; }
.pt-tip-rows svg { flex: none; }
.pt-tip-rows b { min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; }

/* hotspot grid: rows × bays, sequential blue by the number of inspections with findings */
.pt-heat-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 24px; }
.pt-heat-main { flex: 1 1 420px; min-width: 0; max-width: 660px; display: flex; flex-direction: column; gap: 12px; }
.pt-heat-row > .pt-take { flex: 1 1 220px; }
.pt-heat { display: grid; grid-template-columns: 22px repeat(var(--cols, 12), minmax(0, 1fr)); gap: 3px; }
.pt-heat-ch, .pt-heat-rh { display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pt-heat-cell { position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; border-radius: 4px; font-size: 12.5px; font-weight: 700; line-height: 1; }
.pt-heat-cell[tabindex] { cursor: default; }
.pt-heat-cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; z-index: 3; }
.pt-heat-cell.pt-is-hot { z-index: 4; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.pt-heat-cell .pt-tip { bottom: calc(100% + 8px); }
.pt-heat-0 { background: var(--heat-0); }
.pt-heat-1 { background: var(--heat-1); }
.pt-heat-2 { background: var(--heat-2); color: var(--pt-heat-ink-2); }
.pt-heat-3 { background: var(--heat-3); color: var(--pt-heat-ink-3); }
.pt-heat-none { background: transparent; }
.pt-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13.5px; color: var(--ink-2); }
.pt-scale-cap { font-weight: 600; }
.pt-scale-item { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.pt-scale-sw { width: 18px; height: 18px; border-radius: 4px; }
.pt-take { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14.5px; color: var(--ink); }
.pt-take .ico { flex: none; margin-top: 1px; color: var(--accent); }

/* ---------- tables ---------- */
.pt-scroll { max-width: 100%; overflow-x: auto; border: var(--bw) solid var(--line); border-radius: 12px; background: var(--surface); }
.pt-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pt-table caption { text-align: left; }
.pt-table th, .pt-table td { padding: 10px 12px; border-bottom: var(--bw) solid var(--line); text-align: left; vertical-align: middle; }
.pt-table thead th { font-size: 13px; font-weight: 700; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
.pt-table tbody th { font-weight: 600; }
.pt-table tbody tr:last-child > * { border-bottom: 0; }
.pt-table .pt-num { text-align: right; }
.pt-th-cls { display: inline-flex; align-items: center; gap: 5px; }
.pt-nowrap { white-space: nowrap; }
.pt-table--rows tbody tr { cursor: pointer; }
.pt-table--rows tbody tr:hover { background: var(--surface-2); }
.pt-table--rows tbody tr.pt-is-sel { background: var(--accent-soft); }
.pt-rowlink { min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; white-space: nowrap; }
.pt-sort { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.pt-sort:hover { color: var(--ink); }
.pt-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-mini { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 5px; border-radius: 8px; border: var(--bw) solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }

/* ---------- defects: filters ---------- */
.pt-tools { display: flex; flex-direction: column; gap: 12px; }
.pt-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.pt-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 150px; min-width: 0; }
.pt-field--q { flex: 2 1 200px; }
.pt-field .select, .pt-field .input { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
.pt-search { position: relative; }
.pt-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.pt-search .input { padding-left: 38px; }
.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-chip { min-height: 44px; }
.pt-tools-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.pt-count { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 14.5px; color: var(--ink-2); }

/* ---------- defects: board ---------- */
.pt-split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.pt-split-list { flex: 999 1 440px; min-width: 0; }
.pt-split-detail { flex: 1 1 400px; min-width: 0; }
.pt-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(188px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.pt-bcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px; border: var(--bw) solid var(--line); border-radius: 14px; background: var(--surface-2); scroll-snap-align: start; }
.pt-bcol-head { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 4px; font-size: 14.5px; font-weight: 700; line-height: 1.2; color: var(--ink-2); }
.pt-bcol-head .ico { flex: none; }
.pt-bcol-n { margin-left: auto; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--surface); border: var(--bw) solid var(--line); display: inline-grid; place-items: center; font-size: 12.5px; color: var(--ink-2); }
.pt-bcol-empty { padding: 4px 4px 6px; font-size: 13.5px; color: var(--ink-3); }
.pt-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cls cls" "title title" "due due" "meta thumb"; align-items: start; gap: 6px 10px; width: 100%; min-height: 44px; padding: 12px; border: var(--bw) solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.pt-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-1); }
.pt-card.pt-is-sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pt-card-cls { grid-area: cls; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.pt-card-thumb { grid-area: thumb; align-self: end; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; background: var(--photo-bg); }
.pt-card-title { grid-area: title; font-weight: 700; font-size: 15.5px; line-height: 1.3; overflow-wrap: anywhere; }
.pt-card-due { grid-area: due; min-width: 0; }
.pt-card-meta { grid-area: meta; align-self: center; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13.5px; color: var(--ink-3); }
.pt-card-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.pt-due { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; line-height: 1.3; }
.pt-due .ico { flex: none; }
.pt-due--red { color: var(--red); }
.pt-due--amber { color: var(--amber); }
.pt-due--muted { color: var(--ink-3); font-weight: 500; }
.pt-due-date { font-weight: 500; color: var(--ink-3); }

/* ---------- defects: detail ---------- */
.pt-detail { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: 8px 20px 22px; border: var(--bw) solid var(--line); border-radius: 16px; background: var(--surface); }
.pt-d-bar { display: flex; margin-left: -10px; }
.pt-d-head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pt-d-title { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.05; }
.pt-d-comp { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.pt-d-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pt-d-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.pt-d-photos > .fine { grid-column: 1 / -1; }
.pt-photo { margin: 0; aspect-ratio: 1 / 1; max-width: 460px; border-radius: 12px; overflow: hidden; background: var(--photo-bg); }
.pt-d-sec { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pt-d-sec + .pt-d-sec { padding-top: 16px; border-top: var(--bw) solid var(--line); }
.pt-d-note { font-size: 14.5px; color: var(--ink-2); }
.pt-d-note b { color: var(--ink); }
.pt-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pt-hist-li { display: flex; align-items: center; gap: 8px; }
.pt-hist-li + .pt-hist-li::before { content: "→"; content: "→" / ""; color: var(--ink-3); font-weight: 700; }
.pt-hist-item { display: flex; flex-direction: column; gap: 2px; padding: 7px 12px; border: var(--bw) solid var(--line); border-radius: 10px; background: var(--surface-2); }
.pt-hist-cls { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.pt-hist-date { font-size: 13px; color: var(--ink-3); }
.pt-life { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 13.5px; color: var(--ink-3); }
.pt-life li { display: inline-flex; align-items: center; gap: 6px; }
.pt-life li + li::before { content: "→"; content: "→" / ""; color: var(--line-strong); }
.pt-life .pt-is-on > span { padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pt-confirm { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: var(--bw) solid var(--accent-line); border-radius: 12px; background: var(--accent-soft); }
.pt-tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pt-ev { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.pt-ev::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 2px; background: var(--line); }
.pt-ev:last-child { padding-bottom: 0; }
.pt-ev:last-child::before { display: none; }
.pt-ev-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: var(--bw) solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.pt-ev--red .pt-ev-ico { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }
.pt-ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 6px; }
.pt-ev-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; }
.pt-ev-text { color: var(--ink-2); }
.pt-ev-meta { font-size: 13px; color: var(--ink-3); }
.pt-ev-photo { margin: 4px 0 0; width: min(100%, 220px); aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--photo-bg); }
.pt-row-end { display: flex; justify-content: flex-end; }
.pt-file-row { position: relative; display: flex; }
.pt-file-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pt-file-input:focus-visible + .pt-file { outline: 3px solid var(--focus); outline-offset: 2px; }
.pt-file { cursor: pointer; }
.pt-file-input:disabled + .pt-file { opacity: 0.55; cursor: progress; }

/* Narrow content: the detail replaces the list (with its own back button) instead of sitting beside it,
   and the board stacks its lifecycle columns top to bottom instead of scrolling sideways. */
@container ptmain (width < 880px) {
  .pt-split.pt-is-open > .pt-split-list, .pt-page.pt-has-detail .pt-tools { display: none; }
}
@container ptmain (width < 600px) {
  .pt-board { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: visible; scroll-snap-type: none; }
}

/* ---------- CSV dialog (native modal: top layer, focus trap, Esc closes) ---------- */
.pt-dialog { width: min(720px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow: auto; padding: 0; border: var(--bw) solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); font-family: var(--font-body); }
.pt-dialog::backdrop { background: var(--scrim); }
.pt-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 4px 20px; }
.pt-dialog-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 20px 20px; }
.pt-csv { min-height: 200px; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; white-space: pre; overflow: auto; resize: vertical; }

/* ---------- reports ---------- */
.pt-reps { display: grid; gap: 14px; }
.pt-rep { gap: 14px; }
.pt-rep-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }
.pt-rep-num { font-family: var(--font-mono); font-size: 19px; font-weight: 600; line-height: 1.3; }
.pt-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pt-count-i { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.pt-count-i b { font-weight: 700; }
.pt-hash { font-family: var(--font-mono); font-size: 14.5px; font-weight: 500; }
.pt-addenda { display: flex; flex-direction: column; gap: 8px; }
.pt-addenda ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pt-addendum { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-left: 3px solid var(--line-strong); border-radius: 0 10px 10px 0; background: var(--surface-2); }
.pt-verify { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: var(--bw) solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.pt-verify .ico { flex: none; }
.pt-verify--ok { border-color: var(--accent-line); background: var(--accent-soft); }
.pt-verify--ok .ico { color: var(--accent); }
.pt-verify--bad { border-color: var(--line-strong); background: var(--surface-3); }
.pt-verify-title { font-weight: 700; }
.pt-verify-sub { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }

/* ---------- weekly checks ---------- */
.pt-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pt-check { gap: 12px; }
.pt-check-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.pt-check-date { font-weight: 700; }
.pt-check-by { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.pt-check-head .pt-status { margin-left: auto; }
.pt-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pt-rowres { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border: var(--bw) solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.pt-rowres b { color: var(--ink); }
.pt-rowres--issue { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.pt-issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pt-issue { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: var(--bw) solid var(--line); border-radius: 10px; }
.pt-issue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pt-check-none { font-size: 14px; color: var(--ink-3); }
