/* ═══════════════════════════════════════════════════════════════
   AgencyOS — projects-v5.css
   Screen 02 (Projects) — owner-approved V5 Blue design.
   Presentation only; every selector is scoped to #viewProjects .pv5 so no
   other screen can be affected. Behaviour lives in project-directory.js
   (unchanged ProjectService / PersistenceManager contracts).
   ═══════════════════════════════════════════════════════════════ */
#viewProjects .pv5 {
  --pv-primary: var(--cyan, #00d4ff);
  --pv-primary-2: #36d8c7;
  --pv-surface: var(--bg-elevated, #080808);
  --pv-surface-2: rgba(255, 255, 255, .04);
  --pv-line: var(--border-muted, rgba(255, 255, 255, .09));
  --pv-ink: var(--text-primary, #e8e8e8);
  --pv-muted: var(--text-muted, #95959c);
  --pv-soft: var(--cyan-dim, rgba(0, 212, 255, .12));
  --pv-green: #3fb950;
  --pv-green-soft: rgba(63, 185, 80, .14);
  color: var(--pv-ink);
}
[data-theme="light"] #viewProjects .pv5 {
  --pv-primary: #167da0;
  --pv-surface: #fff;
  --pv-surface-2: #f1f6f8;
  --pv-line: #d3e1e6;
  --pv-ink: #10222a;
  --pv-muted: #5d727b;
  --pv-soft: #e4f3f8;
  --pv-green: #138b57;
  --pv-green-soft: #e4f7ed;
}
#viewProjects .pv5 *, #viewProjects .pv5 *::before, #viewProjects .pv5 *::after { box-sizing: border-box; }
#viewProjects .pv5 svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* page head */
.pv5-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.pv5-eyebrow { display: block; color: var(--pv-primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.pv5-head .pd-title { margin: 6px 0 4px; font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.pv5-sub { margin: 0; color: var(--pv-muted); font-size: 14.5px; }
.pv5-new { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--pv-primary); color: #04222b; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; white-space: nowrap; transition: transform .15s ease, filter .15s ease, box-shadow .15s ease; box-shadow: 0 8px 20px color-mix(in srgb, var(--pv-primary) 28%, transparent); }
[data-theme="light"] .pv5-new { color: #fff; }
.pv5-new:hover { transform: translateY(-1px); filter: brightness(1.06); }
.pv5-new:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.pv5-new svg { width: 16px; height: 16px; stroke-width: 2.4; }

/* metrics */
.pv5-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.pv5-metrics > div { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 12px; padding: 18px; }
.pv5-metrics span { display: block; color: var(--pv-muted); font-size: 13px; }
.pv5-metrics strong { display: block; margin-top: 4px; font-size: 28px; font-weight: 800; }

/* toolbar */
.pv5-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pv5-search { flex: 1; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 1px solid var(--pv-line); border-radius: 10px; background: var(--pv-surface); color: var(--pv-muted); transition: border-color .15s ease, box-shadow .15s ease; }
.pv5-search:focus-within { border-color: var(--pv-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-primary) 16%, transparent); }
.pv5-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--pv-ink); font: inherit; font-size: 14px; }
.pv5-search input::placeholder { color: var(--pv-muted); }
.pv5-clear, .pv5-iconbtn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--pv-muted); cursor: pointer; }
.pv5-clear:hover { background: var(--pv-surface-2); color: var(--pv-ink); }
.pv5-seg { display: flex; flex: 0 0 auto; height: 42px; border: 1px solid var(--pv-line); border-radius: 10px; overflow: hidden; background: var(--pv-surface); }
.pv5-seg button { display: grid; place-items: center; width: 44px; border: 0; background: transparent; color: var(--pv-muted); cursor: pointer; }
.pv5-seg button.active { background: var(--pv-soft); color: var(--pv-primary); }
.pv5-filterwrap { position: relative; flex: 0 0 auto; }
.pv5-tool { position: relative; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--pv-line); border-radius: 10px; background: var(--pv-surface); color: var(--pv-muted); cursor: pointer; }
.pv5-tool:hover, .pv5-tool.open { border-color: color-mix(in srgb, var(--pv-primary) 45%, var(--pv-line)); color: var(--pv-primary); }
.pv5-tool.has { background: var(--pv-soft); color: var(--pv-primary); }
.pv5-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--pv-primary); }
.pv5-menu { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: 240px; padding: 8px; border: 1px solid var(--pv-line); border-radius: 12px; background: var(--pv-surface); box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.pv5-menu strong { display: block; padding: 8px 10px 6px; color: var(--pv-muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.pv5-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--pv-ink); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.pv5-menu button:hover { background: var(--pv-surface-2); }
.pv5-menu button.active { color: var(--pv-primary); font-weight: 700; }
.pv5-menu button span { flex: 1; }
.pv5-menu button i { display: grid; width: 18px; }
.pv5-menu button svg { width: 15px; height: 15px; }
.pv5-menu hr { margin: 6px 0; border: 0; border-top: 1px solid var(--pv-line); }

/* status tabs + pager */
.pv5-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.pv5-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.pv5-tabs button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--pv-line); border-radius: 999px; background: var(--pv-surface); color: var(--pv-muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s ease; }
.pv5-tabs button b { font-size: 12px; opacity: .8; }
.pv5-tabs button:hover { border-color: color-mix(in srgb, var(--pv-primary) 45%, var(--pv-line)); color: var(--pv-ink); }
.pv5-tabs button.active { background: var(--pv-primary); border-color: var(--pv-primary); color: #04222b; }
[data-theme="light"] .pv5-tabs button.active { color: #fff; }
.pv5-pager { display: flex; align-items: center; gap: 12px; }
.pv5-range { color: var(--pv-muted); font-size: 13px; }
.pv5-pages { display: flex; gap: 7px; }
.pv5-pages button { min-width: 36px; height: 36px; padding: 0 11px; border: 1px solid var(--pv-line); border-radius: 9px; background: var(--pv-surface); color: var(--pv-muted); font: inherit; font-weight: 700; cursor: pointer; }
.pv5-pages button.active { background: var(--pv-primary); border-color: var(--pv-primary); color: #04222b; }
[data-theme="light"] .pv5-pages button.active { color: #fff; }
.pv5-pages button:disabled { opacity: .42; cursor: not-allowed; }
.pv5-pages button svg { width: 16px; height: 16px; margin: auto; }

/* cards */
#viewProjects .pv5 .pd-grid.pd-grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
#viewProjects .pv5 .pd-grid.pd-list-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pv5-card { position: relative; display: flex; flex-direction: column; min-height: 240px; padding: 20px; border: 1px solid var(--pv-line); border-radius: 12px; background: var(--pv-surface); cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.pv5-card:hover { transform: translateY(-4px); border-color: var(--pv-primary); box-shadow: 0 14px 30px rgba(0, 0, 0, .22); }
.pv5-card:focus-visible { outline: 2px solid var(--pv-primary); outline-offset: 2px; }
.pv5-card.current { border-color: color-mix(in srgb, var(--pv-primary) 55%, var(--pv-line)); }
.pv5-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--pv-muted); font-size: 13px; }
.pv5-stack { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pv5-actions { display: flex; gap: 2px; opacity: .55; transition: opacity .15s ease; }
.pv5-card:hover .pv5-actions, .pv5-card:focus-within .pv5-actions { opacity: 1; }
.pv5-iconbtn { width: 28px; height: 28px; }
.pv5-iconbtn svg { width: 15px; height: 15px; }
.pv5-iconbtn:hover { background: var(--pv-surface-2); color: var(--pv-primary); }
.pv5-iconbtn.danger:hover { color: #f85149; }
.pv5-title { padding: 22px 0 10px; text-align: left; }
.pv5-title h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; overflow-wrap: anywhere; }
.pv5-title p { margin: 4px 0 0; color: var(--pv-muted); font-size: 13.5px; }
.pv5-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--pv-muted); font-size: 13px; }
.pv5-meta small { font-size: 12px; white-space: nowrap; }
.pv5-progress { display: flex; gap: 5px; margin: 18px 0; }
.pv5-progress i { flex: 1; height: 4px; border-radius: 6px; background: var(--pv-line); }
.pv5-progress i.done { background: var(--pv-primary-2); }
.pv5-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }
.pv5-chip { display: inline-flex; align-items: center; width: max-content; padding: 4px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--pv-green) 30%, var(--pv-line)); background: var(--pv-green-soft); color: var(--pv-green); font-size: 12px; font-weight: 700; }
.pv5-chip.soft { background: var(--pv-surface-2); border-color: var(--pv-line); color: var(--pv-muted); }
.pv5-chip.now { background: var(--pv-soft); border-color: color-mix(in srgb, var(--pv-primary) 30%, var(--pv-line)); color: var(--pv-primary); }
.pv5-go { border: 0; background: transparent; color: var(--pv-ink); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.pv5-go:hover { color: var(--pv-primary); }
.pv5-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* list layout */
.pd-list-view .pv5-card { display: grid; grid-template-columns: 150px minmax(200px, 1.3fr) minmax(150px, 1fr) 180px 110px 100px; grid-template-areas: "top title meta progress chip go"; align-items: center; column-gap: 18px; min-height: 0; height: 84px; padding: 12px 20px; }
.pd-list-view .pv5-card:hover { transform: translateY(-2px); }
.pd-list-view .pv5-top { grid-area: top; }
.pd-list-view .pv5-actions { display: none; }
.pd-list-view .pv5-title { grid-area: title; padding: 0; min-width: 0; }
.pd-list-view .pv5-title h2, .pd-list-view .pv5-title p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-list-view .pv5-meta { grid-area: meta; }
.pd-list-view .pv5-progress { grid-area: progress; margin: 0; }
.pd-list-view .pv5-foot { display: contents; }
.pd-list-view .pv5-foot .pv5-chips { grid-area: chip; }
.pd-list-view .pv5-foot .pv5-go { grid-area: go; justify-self: end; white-space: nowrap; }
.pd-list-view .pv5-listactions { display: flex; }

/* states */
#viewProjects .pv5 .pd-loading { padding: 40px 0; text-align: center; color: var(--pv-muted); }
#viewProjects .pv5 .pd-empty { display: grid; justify-items: center; gap: 8px; padding: 56px 20px; border: 1px dashed var(--pv-line); border-radius: 12px; background: var(--pv-surface); text-align: center; }
#viewProjects .pv5 .pd-empty-title { font-size: 17px; font-weight: 800; }
#viewProjects .pv5 .pd-empty-sub { color: var(--pv-muted); font-size: 13.5px; }
#viewProjects .pv5 .pd-empty.is-error { border-color: rgba(248, 81, 73, .45); }
#viewProjects .pv5 .pd-empty.is-error .pd-empty-title { color: #f85149; }

/* responsive */
@media (max-width: 1100px) {
  .pd-list-view .pv5-card { grid-template-columns: 130px minmax(160px, 1.2fr) 150px 100px 90px; grid-template-areas: "top title progress chip go"; }
  .pd-list-view .pv5-meta { display: none; }
}
@media (max-width: 760px) {
  .pv5-head { flex-direction: column; align-items: stretch; }
  .pv5-new { justify-content: center; }
  .pv5-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pv5-metrics > div { padding: 12px; }
  .pv5-metrics strong { font-size: 22px; }
  .pv5-toolbar { flex-wrap: wrap; }
  .pv5-search { flex: 1 1 100%; }
  .pv5-pager { width: 100%; justify-content: space-between; }
  .pd-list-view .pv5-card { display: flex; flex-direction: column; align-items: stretch; height: auto; padding: 18px; }
  .pd-list-view .pv5-foot { display: flex; }
  .pd-list-view .pv5-actions { display: flex; }
  .pd-list-view .pv5-meta { display: flex; }
  .pd-list-view .pv5-title { padding: 18px 0 8px; }
  .pd-list-view .pv5-progress { margin: 14px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pv5-card, .pv5-new, .pv5-tabs button { transition: none; }
  .pv5-card:hover { transform: none; }
}
#viewProjects .pv5 [hidden] { display: none !important; }
.pv5-metrics, .pv5-row { padding-left: var(--page-padding-x); padding-right: var(--page-padding-x); }
.pv5-row { margin-top: 4px; }

/* ── workflow status: tones, 5 totals, tabs ── */
.pv5-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pv5-chip[data-tone="Pending"] { background: var(--pv-surface-2); border-color: var(--pv-line); color: var(--pv-muted); }
.pv5-chip[data-tone="Awaiting approval"] { background: rgba(217, 154, 31, .14); border-color: rgba(217, 154, 31, .35); color: #d99a1f; }
.pv5-chip[data-tone="Client approval"] { background: var(--pv-soft); border-color: color-mix(in srgb, var(--pv-primary) 35%, var(--pv-line)); color: var(--pv-primary); }
.pv5-chip[data-tone="Client revision"] { background: rgba(224, 87, 91, .12); border-color: rgba(224, 87, 91, .35); color: #e0575b; }
.pv5-chip[data-tone="Completed"] { background: var(--pv-green-soft); border-color: color-mix(in srgb, var(--pv-green) 30%, var(--pv-line)); color: var(--pv-green); }
.pv5-menu button em { font-style: normal; color: var(--pv-muted); font-size: 12px; }
@media (max-width: 1050px) { .pv5-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } } /* reference v4.css: 2 columns at <=1050 */
@media (max-width: 720px) { .pv5-metrics { grid-template-columns: minmax(0, 1fr); } } /* reference: 1 column at <=720 */

/* ── project page: status dropdown (V5 wsStatus) ── */
.pv5-ws { position: relative; flex: 0 0 auto; --pv-primary: var(--cyan, #00d4ff); --pv-surface: var(--bg-elevated, #080808); --pv-surface-2: rgba(255, 255, 255, .05); --pv-line: var(--border-accent, rgba(255, 255, 255, .14)); --pv-ink: var(--text-primary, #e8e8e8); --pv-muted: var(--text-muted, #95959c); }
[data-theme="light"] .pv5-ws { --pv-primary: #167da0; --pv-surface: #fff; --pv-surface-2: #f1f6f8; --pv-line: #d3e1e6; --pv-ink: #10222a; --pv-muted: #5d727b; }
.pv5-ws[hidden] { display: none !important; }
.pv5-wsbtn { display: inline-flex; align-items: center; gap: 10px; min-width: 190px; height: 36px; padding: 0 12px; border: 1px solid var(--pv-line); border-radius: 11px; background: var(--pv-surface); color: var(--pv-ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.pv5-wsbtn > span { flex: 1; text-align: left; white-space: nowrap; }
.pv5-wsbtn > svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--pv-muted); transition: transform .2s ease; }
.pv5-wsbtn:hover:not(:disabled), .pv5-wsbtn.open { border-color: color-mix(in srgb, var(--pv-primary) 55%, var(--pv-line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-primary) 12%, transparent); }
.pv5-wsbtn.open > svg { transform: rotate(180deg); }
.pv5-wsbtn:disabled { opacity: .7; cursor: not-allowed; }
.pv5-wsbtn:focus-visible, .pv5-wslist button:focus-visible { outline: 2px solid var(--pv-primary); outline-offset: 2px; }
.pv5-ws .pv5-dot { position: static; flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--pv-muted); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-muted) 18%, transparent); }
.pv5-ws .pv5-dot[data-tone="Awaiting approval"] { background: #d99a1f; box-shadow: 0 0 0 3px rgba(217, 154, 31, .18); }
.pv5-ws .pv5-dot[data-tone="Client approval"] { background: var(--pv-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-primary) 18%, transparent); }
.pv5-ws .pv5-dot[data-tone="Client revision"] { background: #e0575b; box-shadow: 0 0 0 3px rgba(224, 87, 91, .18); }
.pv5-ws .pv5-dot[data-tone="Completed"] { background: #3fb950; box-shadow: 0 0 0 3px rgba(63, 185, 80, .18); }
.pv5-wsmenu { position: absolute; top: 100%; right: 0; z-index: 60; width: 260px; margin-top: 8px; overflow: hidden; border: 1px solid var(--pv-line); border-radius: 16px; background: var(--pv-surface); box-shadow: 0 18px 48px rgba(0, 0, 0, .4); }
.pv5-wshead { display: grid; gap: 2px; padding: 14px 16px 12px; border-bottom: 1px solid var(--pv-line); background: var(--pv-surface-2); }
.pv5-wshead strong { font-size: 14px; color: var(--pv-ink); }
.pv5-wshead small { color: var(--pv-muted); font-size: 12px; }
.pv5-wslist { display: grid; gap: 2px; padding: 8px; }
.pv5-wslist button { display: grid; grid-template-columns: 9px minmax(0, 1fr) 18px; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--pv-ink); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; transition: background-color .12s ease; }
.pv5-wslist button:hover:not(:disabled) { background: var(--pv-surface-2); }
.pv5-wslist button.selected { background: color-mix(in srgb, var(--pv-primary) 10%, transparent); color: var(--pv-primary); }
.pv5-wslist button:disabled { opacity: .45; cursor: not-allowed; }
.pv5-wslist button em { display: grid; place-items: center; }
.pv5-wslist button em svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) { .pv5-wsbtn { min-width: 0; } .pv5-wsmenu { right: auto; left: 0; } }

/* ═══ V5 exact pass — values copied from the reference v4.css ═══ */
#viewProjects {
  --v5-bg: #070a0d;
  background: var(--v5-bg);
}
[data-theme="light"] #viewProjects { --v5-bg: #eef6f8; }
#viewProjects .pv5 {
  --pv-surface: #0d1116; --pv-surface-2: #131c24; --pv-line: #22313b; --pv-ink: #eff7f5; --pv-muted: #8e9aa5;
  --pv-primary: #17c7df; --pv-primary-2: #47e282; --pv-soft: #0e2430;
  --pv-green: #36d8c7; --pv-green-soft: #0b2a2b;
  font-family: var(--app-font, Inter, 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif);
}
[data-theme="light"] #viewProjects .pv5 {
  --pv-surface: #ffffff; --pv-surface-2: #e3f0f3; --pv-line: #cddfe4; --pv-ink: #17252b; --pv-muted: #566a73;
  --pv-primary: #167da0; --pv-primary-2: #24aa9f; --pv-soft: #deeff7;
  --pv-green: #08796f; --pv-green-soft: #dff3f0;
}
#viewProjects .pv5-head .pd-title { margin: 8px 0 6px; font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
#viewProjects .pv5-sub { font-size: 16px; }
#viewProjects .pv5-new { background: linear-gradient(135deg, var(--pv-primary), var(--pv-primary-2)); color: #fff; height: 46px; padding: 0 20px; border-radius: 11px; font-size: 15px; box-shadow: 0 12px 30px color-mix(in srgb, var(--pv-primary) 22%, transparent); }
:root:not([data-theme="light"]) #viewProjects .pv5-new { color: #061014; }

/* totals */
.pv5-metrics > div { padding: 18px; border-radius: 12px; }
.pv5-metrics span { font-size: 14px; }
.pv5-metrics strong { font-size: 28px; font-weight: 800; }

/* toolbar: search + icon segmented + icon button, 44px high */
.pv5-search { height: 44px; padding: 0 8px 0 16px; border-radius: 11px; background: var(--pv-surface); box-shadow: 0 1px 2px rgba(15, 42, 52, .04); }
.pv5-search:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-primary) 14%, transparent); }
.pv5-search input { font-size: 14.5px; }
.pv5-seg { height: 44px; padding: 3px; gap: 2px; border-radius: 11px; }
.pv5-seg button { width: 38px; height: 36px; border-radius: 8px; }
.pv5-seg button.active { background: var(--pv-soft); color: var(--pv-primary); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pv-primary) 22%, transparent); }
.pv5-tool { width: 44px; height: 44px; border-radius: 11px; }

/* status tabs: one soft pill container, white active tab with count bubble */
.pv5-tabs { gap: 2px; padding: 4px; border: 1px solid var(--pv-line); border-radius: 14px; background: var(--pv-surface-2); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.pv5-tabs::-webkit-scrollbar { display: none; }
.pv5-tabs button { height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--pv-muted); font-size: 13px; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.pv5-tabs button:hover:not(.active) { color: var(--pv-ink); background: color-mix(in srgb, var(--pv-surface) 55%, transparent); border: 0; }
.pv5-tabs button.active { background: var(--pv-surface); color: var(--pv-primary); border: 0; box-shadow: 0 1px 2px rgba(15, 42, 52, .08), 0 4px 12px color-mix(in srgb, var(--pv-primary) 14%, transparent); }
.pv5-tabs button b { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--pv-muted) 16%, transparent); color: var(--pv-muted); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; opacity: 1; }
.pv5-tabs button.active b { background: var(--pv-primary); color: #fff; }
:root:not([data-theme="light"]) .pv5-tabs button.active b { color: #061014; }
.pv5-row { margin-bottom: 24px; }

/* pager: range text + bordered control group */
.pv5-pager { gap: 14px; justify-content: flex-end; }
.pv5-range { font-size: 12px; font-weight: 600; }
.pv5-pages { gap: 4px; padding: 4px; border: 1px solid var(--pv-line); border-radius: 12px; background: var(--pv-surface); }
.pv5-pages button { min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--pv-muted); font-size: 13px; font-weight: 700; box-shadow: none; }
.pv5-pages button:hover:not(:disabled):not(.active) { background: var(--pv-surface-2); color: var(--pv-ink); }
.pv5-pages button.active { background: var(--pv-primary); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--pv-primary) 28%, transparent); }
:root:not([data-theme="light"]) .pv5-pages button.active { color: #061014; }
.pv5-pages button svg { width: 17px; height: 17px; stroke-width: 2.2; }

/* cards */
#viewProjects .pv5 .pd-grid.pd-grid-view { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
/* (reference has no 3-column step: 4 columns until 1050px) */
@media (max-width: 1050px) { #viewProjects .pv5 .pd-grid.pd-grid-view { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { #viewProjects .pv5 .pd-grid.pd-grid-view { grid-template-columns: minmax(0, 1fr); } }
.pv5-card { min-height: 300px; padding: 20px; border-radius: 12px; }
.pv5-card:hover { transform: translateY(-4px); border: 1px solid var(--pv-primary); box-shadow: none; }
.pv5-top { font-size: 13px; }
.pv5-stack { max-width: 72%; font-weight: 500; letter-spacing: .01em; }
.pv5-title { padding: 24px 0 8px; }
.pv5-title h2 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.pv5-title p { margin-top: 6px; font-size: 17px; }
.pv5-meta { margin-top: 14px; font-size: 14px; align-items: flex-start; }
.pv5-meta small { font-size: 15px; color: var(--pv-ink); text-align: right; white-space: normal; }
.pv5-progress { margin: 16px 0 18px; }
.pv5-progress i.done { background: var(--pv-green); }
.pv5-chip { padding: 4px 10px; font-size: 12px; font-weight: 700; }
.pv5-chip[data-tone="Pending"] { background: var(--pv-green-soft); border-color: color-mix(in srgb, var(--pv-green) 28%, var(--pv-line)); color: var(--pv-green); }
.pv5-chip[data-tone="Completed"] { background: var(--pv-green-soft); color: var(--pv-green); }
.pv5-go { font-size: 17px; font-weight: 400; }
.pv5-actions { opacity: 0; }
.pv5-card:hover .pv5-actions, .pv5-card:focus-within .pv5-actions { opacity: 1; }
[data-theme="light"] .pv5-tabs button.active { color: var(--pv-primary); }
[data-theme="light"] .pv5-tabs button.active b { color: #fff; }
#viewProjects .pv5 .pv5-toolbar, #viewProjects .pv5 .page-toolbar { border-bottom: 0; }
.pv5-meta span { font-size: 13px; color: var(--pv-muted); }
.pv5-meta small { font-size: 14px; font-weight: 500; white-space: nowrap; }
.pv5-progress i { height: 4px; }
#viewProjects #projectDirectoryScreen.pv5, #viewProjects .pd-shell { background: transparent; }

/* ── spacing rhythm (matches the reference: 24 / 16 / 22) + hover stability ── */
#viewProjects .pv5 .pv5-metrics { margin-bottom: 24px; }
#viewProjects .pv5 .pd-toolbar.page-toolbar.pv5-toolbar { padding-top: 0; padding-bottom: 0; margin-bottom: 16px; }
#viewProjects .pv5 .pv5-row { margin-top: 0; margin-bottom: 22px; }
#viewProjects .pv5 .pd-body.page-content { padding-top: 0; }
/* The card lifts 4px on hover; without this the pointer could fall out of the
   card's bottom edge, un-hover it and make it jitter ("hang"). The invisible
   strip keeps the lifted card hovered, and only compositor-friendly
   properties animate. */
.pv5-card { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }   /* no will-change: it kept one GPU layer per project card alive (70+ on Production) and can blank tiles while hovering */
.pv5-card::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -6px; height: 6px; }
.pv5-card:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--pv-primary) 10%, transparent); }
.pd-list-view .pv5-card::after { display: none; }

/* hover lift must never reach the tabs: more breathing room above the first
   row, a smaller lift, and the tabs row always paints above the cards */
#viewProjects .pv5 .pv5-row { margin-bottom: 30px; position: relative; z-index: 2; }
#viewProjects .pv5 .pd-grid { padding-top: 6px; }
.pv5-card:hover { transform: translateY(-3px); }
.pd-list-view .pv5-card:hover { transform: translateY(-2px); }

/* ── card density copied from the reference (≈250px card, no dead space) ── */
.pv5-card { min-height: 0; padding: 20px; }
.pv5-title { padding: 22px 0 0; }
.pv5-title h2 { font-size: 24px; line-height: 1.2; }
.pv5-title p { margin-top: 5px; font-size: 17px; line-height: 1.3; }
.pv5-meta { margin-top: 25px; align-items: center; gap: 10px; }
.pv5-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv5-meta small { flex: 0 0 auto; }
.pv5-progress { margin: 20px 0 21px; }
.pv5-foot { margin-top: auto; }
.pd-list-view .pv5-card { height: 84px; }

/* names/types stay fully readable (wrap instead of "…"); slightly tighter title so
   fewer names wrap at laptop widths and the row has less spare height */
.pv5-meta span { overflow: visible; text-overflow: clip; white-space: normal; }
.pv5-meta { align-items: flex-start; }
.pv5-title h2 { font-size: 22px; }
.pv5-title p { font-size: 16px; }
/* the page title class sets its own font; the reference uses Inter everywhere on this screen */
#viewProjects .pv5 .pd-title, #viewProjects .pv5 button, #viewProjects .pv5 input { font-family: inherit; }

/* ── typography: weights and sizes measured from the reference (Inter) ── */
#viewProjects .pv5-head .pd-title { font-weight: 700; font-size: 36px; letter-spacing: -.02em; line-height: 1.12; }
#viewProjects .pv5-new { font-weight: 600; font-size: 16px; }
.pv5-metrics span { font-size: 13px; font-weight: 400; }
.pv5-metrics strong { font-weight: 700; }
.pv5-stack { font-weight: 400; letter-spacing: normal; }
.pv5-title h2 { font-weight: 700; font-size: 24px; letter-spacing: -.015em; }
.pv5-title p { font-size: 16px; font-weight: 400; }
.pv5-meta span { font-size: 13px; font-weight: 400; }
.pv5-meta small { font-size: 13.33px; font-weight: 400; }
.pv5-go { font-size: 16px; font-weight: 400; }
#viewProjects .pv5-head .pd-title { font-weight: 400; }
#viewProjects .pv5-head .pd-title { font-weight: 600; }
#viewProjects .pv5-head .pd-title { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
#viewProjects .pv5-head .pd-title { font-weight: 700; }

/* ── exact vertical rhythm measured from the reference screenshot ──
   card: code +31, name +77, client +108, meta +153, progress +184, chip +217, height 251 */
.pv5-card { padding: 20px; }
.pv5-top { position: relative; height: 20px; line-height: 20px; }
.pv5-actions { position: absolute; right: -6px; top: -4px; }
.pv5-title { padding: 22px 0 0; }
.pv5-title h2 { line-height: 1.2; }
.pv5-title p { margin-top: 6px; line-height: 1.4; }
.pv5-meta { margin-top: 23px; line-height: 20px; }
.pv5-progress { margin: 19px 0 19px; }
.pv5-foot { align-items: center; }
.pv5-chip { padding: 3px 10px; }
.pv5-go { line-height: 24.8px; }
#viewProjects .pv5 .pd-grid.pd-grid-view { column-gap: 16px; row-gap: 18px; }
#viewProjects .pv5 .pv5-row { margin-bottom: 24px; }
#viewProjects .pv5 .pd-grid { padding-top: 0; }
.pv5-card:hover { transform: translateY(-2px); }

/* ── header block rhythm from the reference: eyebrow 27 / title 58 / sub 90 / tiles 127 ── */
#viewProjects .pv5 .pv5-head { margin-top: -5px; margin-bottom: 24px; }
#viewProjects .pv5-head .pd-title { margin: 2px 0 0; }
#viewProjects .pv5-sub { margin: 0; line-height: 1.55; }
#viewProjects .pv5-new { margin-top: -7px; height: 45px; }
#viewProjects .pv5 .pv5-head { margin-bottom: 19px; }

/* the page body scrolls (overflow clips); give the lifted first row + its shadow room
   so hover is never cut off — spacing above the cards stays 24px in total */
#viewProjects .pv5 .pv5-row { margin-bottom: 18px; }
#viewProjects .pv5 .pd-body.page-content { padding-top: 6px; padding-bottom: 24px; }

/* ═══ LIST VIEW — copied from the reference (.projectList .projectCard) ═══
   row: 96px high, padding 14px 22px, 12px between rows,
   columns: code 180 | name+client 1.25fr | type … due 1fr | progress 180 | status 140 | Continue 130 */
#viewProjects .pv5 .pd-grid.pd-list-view { grid-template-columns: minmax(0, 1fr); row-gap: 12px; column-gap: 0; }
.pd-list-view .pv5-card {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1.25fr) minmax(180px, 1fr) 180px 140px 130px;
  grid-template-areas: "top title meta progress chip go";
  align-items: center; column-gap: 18px; row-gap: 0;
  height: 96px; min-height: 96px; padding: 14px 22px;
}
.pd-list-view .pv5-card:hover { transform: translateY(-2px); }
.pd-list-view .pv5-top { grid-area: top; height: auto; min-width: 0; }
.pd-list-view .pv5-stack { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-list-view .pv5-title { grid-area: title; padding: 0; min-width: 0; align-self: center; }
.pd-list-view .pv5-title h2 { margin: 0 0 3px; font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-list-view .pv5-title p { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-list-view .pv5-meta { grid-area: meta; margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-width: 0; }
.pd-list-view .pv5-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pd-list-view .pv5-meta small { white-space: nowrap; flex: 0 0 auto; }
.pd-list-view .pv5-progress { grid-area: progress; margin: 0; width: 100%; }
.pd-list-view .pv5-foot { display: contents; }
.pd-list-view .pv5-foot .pv5-chips { grid-area: chip; justify-self: start; flex-wrap: nowrap; min-width: 0; }
.pd-list-view .pv5-foot .pv5-go { grid-area: go; justify-self: end; white-space: nowrap; }
/* row actions stay reachable: small overlay in the corner, visible on hover */
.pd-list-view .pv5-actions { display: flex; position: absolute; top: 6px; right: 10px; }
.pd-list-view .pv5-card::after { display: none; }
@media (max-width: 1280px) {
  .pd-list-view .pv5-card { grid-template-columns: 130px minmax(160px, 1.2fr) minmax(150px, 1fr) 130px 130px 110px; column-gap: 14px; padding: 14px 18px; }
}
@media (max-width: 1000px) {
  .pd-list-view .pv5-card { grid-template-columns: 110px minmax(140px, 1.2fr) 120px 120px 100px; grid-template-areas: "top title progress chip go"; }
  .pd-list-view .pv5-meta { display: none; }
}
@media (max-width: 760px) {
  .pd-list-view .pv5-card { display: flex; flex-direction: column; align-items: stretch; height: auto; min-height: 0; padding: 18px; }
  .pd-list-view .pv5-foot { display: flex; }
  .pd-list-view .pv5-meta { display: flex; }
  .pd-list-view .pv5-title { padding: 18px 0 8px; }
  .pd-list-view .pv5-progress { margin: 14px 0; }
  .pd-list-view .pv5-title h2, .pd-list-view .pv5-title p { white-space: normal; }
}

/* list view: the action icons must anchor to the row corner, not to the code cell */
.pd-list-view .pv5-top { position: static; }
.pd-list-view .pv5-actions { top: 8px; right: 12px; z-index: 2; }
.pd-list-view .pv5-actions { top: 3px; right: 10px; }
.pd-list-view .pv5-iconbtn { width: 26px; height: 26px; }

/* ── search bar: the input must be a bare field inside the bar (no second border /
   focus box from the app's global input styles, no native "×" next to ours) ── */
#viewProjects .pv5 .pv5-search input,
#viewProjects .pv5 .pv5-search input:hover,
#viewProjects .pv5 .pv5-search input:focus,
#viewProjects .pv5 .pv5-search input:focus-visible {
  -webkit-appearance: none; appearance: none;
  border: 0; outline: 0; box-shadow: none; border-radius: 0;
  background: transparent; padding: 0; margin: 0;
  height: 100%; min-width: 0; flex: 1;
  color: var(--pv-ink); font: inherit; font-size: 14.5px;
}
#viewProjects .pv5 .pv5-search input::-webkit-search-cancel-button,
#viewProjects .pv5 .pv5-search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
#viewProjects .pv5 .pv5-search > svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--pv-muted); }
#viewProjects .pv5 .pv5-search:focus-within > svg { color: var(--pv-primary); }

/* ── pagination: arrows were sitting 3px above the numbers (inline-svg baseline) ── */
.pv5-pages button { display: grid; place-items: center; line-height: 1; padding: 0 8px; }
.pv5-pages button svg { display: block; margin: 0; width: 17px; height: 17px; }
.pv5-pages .pv5-arrow, .pv5-pages button[aria-label$="page"] { width: 32px; padding: 0; }
.pv5-pages button:disabled { opacity: .35; cursor: not-allowed; }
.pv5-pages button:focus-visible { outline: 2px solid var(--pv-primary); outline-offset: 1px; }
.pv5-range { line-height: 18px; }

/* ── Projects page main padding: 24px (reference) — all sections share this token ── */
#viewProjects { --page-padding-x: 24px; }
#viewProjects .pv5 .pd-header.page-header { padding-left: 24px; padding-right: 24px; }

/* top padding 24px: header content (eyebrow + New Project) starts exactly 24px below the page top */
#viewProjects .pv5 .pd-header.page-header.pv5-head { margin-top: 0; padding-top: 24px; }
#viewProjects .pv5-new { margin-top: 0; }

/* heading block uses the same line-box model as Build Queue / Approvals: the eyebrow sits inline in a 1.55 line box, then the title with no extra margin */
#viewProjects .pv5-head > div { font-size: 16px; line-height: 1.55; }
#viewProjects .pv5-head .pv5-eyebrow { display: inline; }
#viewProjects .pv5-head .pd-title { margin: 0; }
#viewProjects .pv5-head .pv5-sub { margin: 0; font-size: 16px; line-height: 1.55; }
.pv5-pages .pv5-gap { display: grid; place-items: center; min-width: 22px; height: 36px; color: var(--pv-muted); font-weight: 700; letter-spacing: 1px; user-select: none; }

/* Whole-page vertical scrolling. Before, .view-page / .pd-screen were overflow:hidden and only the list region (.pd-body) scrolled, so the wheel
   did nothing over the header/cards/filters and the list was left with a few hundred px. Now #viewProjects scrolls as one page. */
#viewProjects { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
#viewProjects:focus { outline: none; }
#viewProjects .pd-screen { flex: 0 0 auto; min-height: 100%; overflow: visible; }
#viewProjects .pd-shell.page-layout { flex: 0 0 auto; min-height: 100%; }
#viewProjects .pd-body.page-content { flex: 0 0 auto; overflow: visible; }

/* Status dimensions (project / Homepage / Pages / Job). Same palette as the existing chips; no new colours. */
.pv5-chip[data-tone="Not started"] { background: var(--pv-surface-2); border-color: var(--pv-line); color: var(--pv-muted); }
.pv5-chip[data-tone="In progress"], .pv5-chip[data-tone="Generating"], .pv5-chip[data-tone="Running"], .pv5-chip[data-tone="Partly ready"] { background: var(--pv-soft); border-color: color-mix(in srgb, var(--pv-primary) 35%, var(--pv-line)); color: var(--pv-primary); }
.pv5-chip[data-tone="Ready"] { background: var(--pv-green-soft); border-color: color-mix(in srgb, var(--pv-green) 30%, var(--pv-line)); color: var(--pv-green); }
.pv5-chip[data-tone="Queued"] { background: var(--pv-surface-2); border-color: var(--pv-line); color: var(--pv-muted); }
.pv5-chip[data-tone="Failed"] { background: rgba(224, 87, 91, .12); border-color: rgba(224, 87, 91, .35); color: #e0575b; }
.pv5-ws .pv5-dot[data-tone="Not started"] { background: var(--pv-muted); }
.pv5-ws .pv5-dot[data-tone="In progress"] { background: var(--pv-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-primary) 18%, transparent); }

/* ── Project cards: stable footer. The status chips use the full card width and wrap horizontally (one to three chips, one or two rows); Continue → sits on its own
   line, always bottom-right. Cards in a grid row share one height, so every Continue → shares the same baseline. Grid view only — list view keeps its own columns. ── */
:not(.pd-list-view) > .pv5-card { height: 100%; }
:not(.pd-list-view) > .pv5-card .pv5-foot { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: auto; }
:not(.pd-list-view) > .pv5-card .pv5-chips { width: 100%; min-width: 0; flex-wrap: wrap; align-content: flex-start; min-height: 26px; }
:not(.pd-list-view) > .pv5-card .pv5-go { align-self: flex-end; white-space: nowrap; padding: 2px 0; line-height: 1.4; }
.pv5-chip { white-space: nowrap; }
.pd-list-view .pv5-chip.soft { display: none; }   /* list rows have one chip column: lifecycle only; Homepage / Pages / Job live on the card view */
/* List view between 1281px and the full-width layout: the fixed columns summed to more than the content width (Continue → spilled outside the row at 1366px). Same columns, allowed to shrink. */
@media (min-width: 1281px) {
  .pd-list-view .pv5-card { grid-template-columns: minmax(120px, 180px) minmax(180px, 1.25fr) minmax(140px, 1fr) minmax(110px, 180px) minmax(120px, 140px) minmax(100px, 130px); column-gap: 14px; padding-left: 18px; padding-right: 18px; }
}
