/* Shared list-page pattern (Change orders list, 2026-09-26), used by the Job Costing pages: summary strip, tools, status board or grouped list, fly-in, filters and Needs attention panels. */

  :root { --ai: var(--helm-purple); --ai-dim: var(--helm-purple-dim); --ease: cubic-bezier(.22,.8,.24,1); }
  [data-radix-popper-content-wrapper] { z-index: 500 !important; }
  .v-sand { --hue: color-mix(in srgb, var(--accent) 45%, var(--chart-5)); --tint: color-mix(in srgb, var(--hue) 10%, var(--card)); --tint-line: color-mix(in srgb, var(--hue) 28%, var(--border)); }
  .pl { position: relative; display: flex; flex-direction: column; gap: 6px; padding-left: 6px; padding-right: 2px; padding-bottom: var(--space-md); min-width: 0; }
  .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .tools .search { width: 210px; height: 32px; }
  .tools .count { color: var(--helm-text-dim); font-size: var(--font-size-sm); }
  .tools .grow { flex: 1; }
  .tools .sel { height: 32px; width: 172px; }
  .tools .sel > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .xc { display: inline-flex; gap: 2px; }
  .tools .lbl { font-size: var(--font-size-xs); color: var(--helm-text-dim); }
  /* summary strip */
  .strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .stat { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); min-width: 0; }
  .stat .ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
  .stat b { display: block; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
  .stat span { font-size: var(--font-size-xs); color: var(--helm-text-dim); }
  .stat.navy .ic { background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); }
  .stat.info .ic { background: var(--helm-blue-dim); color: var(--helm-blue); }
  .stat.warn .ic { background: var(--helm-orange-dim); color: var(--helm-orange); }
  .stat.red .ic { background: var(--helm-red-dim); color: var(--helm-red); }
  /* groups */
  .grp { border: 1px solid var(--tint-line); border-radius: 12px; background: var(--card); overflow: hidden; }
  .grp-head { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--tint); }
  .grp.open .grp-head { border-bottom: 1px solid var(--tint-line); }
  .grp-head:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
  .grp-chip { width: 26px; height: 26px; border-radius: 7px; background: var(--hue); color: var(--card); display: flex; align-items: center; justify-content: center; flex: none; }
  .grp-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .grp-title b { font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .grp-title span { font-size: var(--font-size-xs); color: var(--helm-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .grp-meta { display: flex; align-items: center; gap: 12px; font-size: var(--font-size-xs); color: var(--helm-text-dim); white-space: nowrap; }
  .grp-meta b { color: var(--foreground); font-size: var(--font-size-sm); font-variant-numeric: tabular-nums; }
  .chev { color: var(--muted-foreground); display: flex; transition: transform .2s; }
  .grp:not(.open) .chev { transform: rotate(-90deg); }
  .grp-body { padding: 6px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 8px; }
  .grp:not(.open) .grp-body { display: none; }
  /* PO card: fixed height, no labels, tooltips for detail */
  .pc { all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 20px 19px 16px 6px 20px; row-gap: 6px; height: 124px; padding: 10px 12px;
    background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 2px color-mix(in srgb, var(--foreground) 6%, transparent); transition: border-color .15s, box-shadow .15s, transform .15s; }
  .pc:hover { border-color: color-mix(in srgb, var(--hue, var(--primary)) 50%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-1px); }
  .pc:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
  .pc.sel { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
  .pc .r1 { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
  .pn { font-family: var(--font-family-mono); font-size: 0.75rem; font-weight: 600; color: var(--helm-text-dim); }
  .st { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 9999px; font-size: 0.6875rem; font-weight: 600; white-space: nowrap; }
  .st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .st.neutral { background: var(--helm-s2); color: var(--helm-text-dim); }
  .st.info { background: var(--helm-blue-dim); color: var(--helm-blue); }
  .st.success { background: var(--helm-green-dim); color: var(--helm-green); }
  .st.warning { background: var(--helm-orange-dim); color: color-mix(in srgb, var(--helm-orange) 75%, var(--foreground)); }
  [data-theme=dark] .st.warning { color: var(--helm-orange); }
  .st.danger { background: var(--helm-red-dim); color: var(--helm-red); }
  .pc .vendor { font-size: 0.9375rem; font-weight: 600; line-height: 19px; }
  .pc .sub { font-size: 0.75rem; color: var(--helm-text-dim); line-height: 16px; }
  .one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; display: block; }
  .bar { display: flex; gap: 3px; height: 6px; align-self: center; }
  .bar i { flex: 1; border-radius: 3px; background: var(--helm-s3); }
  .bar i.on { background: var(--helm-green); }
  .bar i.part { background: linear-gradient(90deg, var(--helm-green) 55%, var(--helm-s3) 55%); }
  .pc .r5 { display: flex; align-items: center; gap: 8px; font-size: 0.6875rem; }
  .amt { font-weight: 700; font-size: 0.8125rem; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--helm-s2); border: 1px solid var(--border); }
  .due { display: inline-flex; align-items: center; gap: 3px; color: var(--helm-text-dim); white-space: nowrap; }
  .due.late { color: var(--helm-red); font-weight: 600; }
  .ic-row { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: var(--helm-text-dim); }
  .ic-row .ai { color: var(--ai); }
  .ic-row .warnc { color: var(--helm-orange); }
  .av { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 0.5625rem; font-weight: 700; background: var(--helm-s3); }
  /* key */
  .card-key { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
  .ck-head { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
  .ck-head b { font-size: var(--font-size-xs); letter-spacing: .05em; text-transform: uppercase; color: var(--helm-text-dim); }
  .card-key .chev { margin-left: auto; }
  .card-key:not(.open) .chev { transform: rotate(-90deg); }
  .ck-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 2px 10px 10px; font-size: var(--font-size-xs); color: var(--helm-text-dim); }
  .ck-body .k { display: inline-flex; align-items: center; gap: 6px; }
  /* fly-in: very succinct */
  .fly { position: absolute; top: 0; right: 0; width: min(340px, 92%); max-height: 100%; z-index: 20; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius) 0 0 var(--radius);
    box-shadow: -16px 0 32px -12px rgba(0,0,0,.22); transform: translateX(calc(100% + 24px)); visibility: hidden; transition: transform 340ms var(--ease), visibility 0s linear 340ms; }
  .fly.in { transform: none; visibility: visible; transition: transform 340ms var(--ease), visibility 0s; }
  .fly-head { position: relative; padding: 7px 10px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--border); }
  .fly-head .r { display: flex; align-items: center; gap: 8px; }
  .fly-head h2 { margin: 0; font-size: 1.0625rem; font-weight: 600; padding-right: 30px; }
  .fly-head .job { font-size: var(--font-size-xs); color: var(--helm-text-dim); }
  .fly-x { all: unset; cursor: pointer; position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--helm-text-dim); }
  .fly-x:hover { background: var(--helm-s2); color: var(--foreground); }
  .fly-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
  .big { display: flex; justify-content: space-between; align-items: baseline; }
  .big b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
  .big span { font-size: var(--font-size-xs); color: var(--helm-text-dim); }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0; }
  .facts dt { font-size: 0.625rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--helm-text-dim); }
  .facts dd { margin: 0; font-size: var(--font-size-sm); font-weight: 500; }
  .facts dd.late { color: var(--helm-red); }
  .track { display: flex; align-items: center; gap: 0; }
  .track .s { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.625rem; color: var(--helm-text-dim); position: relative; }
  .track .s i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); background: var(--card); z-index: 1; box-sizing: border-box; }
  .track .s + .s::before { content: ""; position: absolute; top: 5px; right: 50%; width: 100%; height: 2px; background: var(--border); }
  .track .s.done i { background: var(--helm-green); border-color: var(--helm-green); }
  .track .s.done + .s::before, .track .s.now::before { background: var(--helm-green); }
  .track .s.now i { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
  .track .s.now { color: var(--foreground); font-weight: 600; }
  .lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--font-size-sm); }
  .lines li { display: flex; gap: 8px; }
  .lines li span:first-child { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lines li span:last-child { font-variant-numeric: tabular-nums; color: var(--helm-text-dim); }
  .lines .more { color: var(--helm-text-dim); font-size: var(--font-size-xs); }
  .fly-foot { display: flex; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--border); }
  .fly-foot > * { flex: 1; }
  .fly h3 { margin: 0 0 4px; font-size: 0.625rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--helm-text-dim); }
  /* panels */
  .fp { display: flex; flex-direction: column; gap: 8px; padding: 6px 12px 12px; }
  .fp-sec { display: flex; flex-direction: column; gap: 6px; }
  .fp-sec > .text-overline { color: var(--helm-text-dim); }
  .fp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--font-size-sm); }
  .fp-check { display: flex; align-items: center; gap: 8px; font-size: var(--font-size-sm); }
  .fp-check .n { margin-left: auto; color: var(--helm-text-dim); font-variant-numeric: tabular-nums; font-size: var(--font-size-xs); }
  .clear { all: unset; cursor: pointer; color: var(--link); font-weight: 600; font-size: var(--font-size-sm); }
  .na { display: flex; flex-direction: column; gap: 8px; padding: 6px 12px 12px; }
  .na-sec { display: flex; flex-direction: column; gap: 4px; }
  .na-head { display: flex; justify-content: space-between; align-items: baseline; }
  .na-head .text-overline { color: var(--helm-text-dim); }
  .na-row { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
  .na-row:hover { background: var(--helm-s2); }
  .na-row .t { font-size: var(--font-size-sm); font-weight: 600; }
  .na-row .d { font-size: var(--font-size-xs); color: var(--helm-text-dim); }
  @media (max-width: 900px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 600px) {
    .tools .search { width: 100%; }
    .tools .grow { display: none; }
    .xc { order: 5; width: 100%; justify-content: flex-end; }
    .tools .sel { flex: 1; min-width: 0; width: auto; }
    .strip { gap: 6px; }
    .stat { padding: 8px 10px; }
    .stat .ic { display: none; }
    .stat span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .grp-body { grid-template-columns: 1fr; }
    .grp-meta .n { display: none; }
    .fly { position: fixed; top: 0; bottom: 0; width: 100%; max-height: none; border-radius: 0; border-left: 0; z-index: 400; }
  }
  /* list view: same groups, one row per record (Deb: switch between list and cards) */
  .vt { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--helm-s2); border: 1px solid var(--border); height: 32px; box-sizing: border-box; }
  .vt button { all: unset; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 30px; border-radius: 6px; font-size: var(--font-size-xs); font-weight: 600; color: var(--helm-text-dim); }
  .vt button[aria-pressed=true] { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }
  .vt button:focus-visible { outline: 2px solid var(--ring); }
  .grp-body.rows { display: block; padding: 0; overflow-x: auto; }
  .lt { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); }
  .lt th { text-align: left; font-size: 0.625rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--helm-text-dim); padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
  .lt td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .lt tr:last-child td { border-bottom: 0; }
  .lt tbody tr { cursor: pointer; }
  .lt tbody tr:hover td { background: color-mix(in srgb, var(--primary) 4%, transparent); }
  .lt tbody tr.sel td { background: color-mix(in srgb, var(--primary) 8%, transparent); }
  .lt .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .lt .main { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
  .lt .sub2 { display: block; font-size: 0.6875rem; color: var(--helm-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
  .lt .bar { width: 70px; }
  .lt .only-s { display: none; }
  @media (max-width: 600px) { .lt .only-s { display: flex; width: fit-content; margin: 3px 0 0 auto; } .lt .hide-s { display: none; } .lt .main, .lt .sub2 { max-width: 170px; } .vt { order: 6; } .xc { order: 7; width: auto; margin-left: auto; } .tools .sel { flex: 1 1 38%; } }
  .gain { color: var(--helm-green); font-weight: 600; }
  @media (max-width: 1280px) { .lt .hide-m { display: none; } .lt .main, .lt .sub2 { max-width: 200px; } .lt td, .lt th { padding-left: 7px; padding-right: 7px; } }
  .toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 600; background: var(--foreground); color: var(--background); padding: 9px 14px; border-radius: 10px; font-size: var(--font-size-sm); box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }

  /* Job Costing additions (2026-10-02) */
  .meter { display: block; height: 6px; border-radius: 3px; background: var(--helm-s3); overflow: hidden; align-self: center; }
  .meter i { display: block; height: 100%; border-radius: 3px; background: var(--helm-green); }
  .meter.info i { background: var(--helm-blue); } .meter.warn i { background: var(--helm-orange); } .meter.red i { background: var(--helm-red); }
  .lt .meter { width: 80px; }
  .mt { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 9999px; font-size: 0.625rem; font-weight: 700; white-space: nowrap; }
  .mt.ok { background: var(--helm-green-dim); color: var(--helm-green); }
  .mt.told { background: var(--helm-blue-dim); color: var(--helm-blue); }
  .mt.short { background: var(--helm-orange-dim); color: color-mix(in srgb, var(--helm-orange) 75%, var(--foreground)); }
  .mt.bad { background: var(--helm-red-dim); color: var(--helm-red); }
  .mt.none { background: var(--helm-s2); color: var(--helm-text-dim); }
  [data-theme=dark] .mt.short { color: var(--helm-orange); }
  .age { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .age button { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); min-width: 0; }
  .age button[aria-pressed=true] { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
  .age button:focus-visible { outline: 2px solid var(--ring); }
  .age b { font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
  .age span { font-size: 0.6875rem; color: var(--helm-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .age .t-ok b { color: var(--foreground); } .age .t-warn b { color: color-mix(in srgb, var(--helm-orange) 80%, var(--foreground)); } .age .t-red b { color: var(--helm-red); }
  .age i { display: block; height: 4px; border-radius: 2px; background: var(--helm-s3); overflow: hidden; } .age i em { display: block; height: 100%; background: currentColor; }
  .age .t-ok i em { background: var(--helm-green); } .age .t-warn i em { background: var(--helm-orange); } .age .t-red i em { background: var(--helm-red); }
  @media (max-width: 600px) { .age { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
  .pl { overflow-x: clip; }
  /* Summary card: KPIs and the aging / due row, collapsible, remembered per page (Deb, 2026-10-02) */
  .kpi { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
  .kpi-head { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 10px; min-width: 0; }
  .kpi-head:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
  .kpi-head b { font-size: var(--font-size-xs); letter-spacing: .05em; text-transform: uppercase; color: var(--helm-text-dim); flex: none; }
  .kpi-sum { flex: 1; min-width: 0; font-size: var(--font-size-xs); color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
  .kpi .chev { margin-left: auto; }
  .kpi:not(.open) .chev { transform: rotate(-90deg); }
  .kpi.open .kpi-head { border-bottom: 1px solid var(--border); }
  .kpi-body { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
  .kpi-body .stat { background: var(--helm-s2); border-color: transparent; }
