/* ============================================================================
   PROJECTS — home cards + list rows, create drawer bits, detail page layout,
   the CFO panel and the activity strip. (Projects build steps e–j.)
   Visual grammar reused: tagpl-card sizing for the stat cards, row-card rows,
   filter-panel drawers, status-pill for state, tooltip.css for every number's
   hover calculation.
   ============================================================================ */

/* spec truncation: client ~20ch, project name ~25ch, full text on hover (title attr) */
.pj-trunc { display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.pj-trunc--client { max-width: 20ch; }
.pj-trunc--name { max-width: 25ch; }

/* list rows for non-card projects — single line, name truncates first */
.pj-rows .row-card { cursor: pointer; }
.pj-rows .row-card__cell--name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---- Create drawer bits ---- */
.pj-primarytag { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pj-primarytag__chip { font-size: var(--text-sm); font-weight: var(--weight-medium); background: var(--color-bg-subtle); border: var(--border-width) solid var(--color-border); border-radius: 999px; padding: 5px 12px; }
.pj-primarytag__edit { font-size: var(--text-sm); color: var(--color-text-muted); background: none; border: none; cursor: pointer; text-decoration: underline; padding: 0; }
.pj-tagpick { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow: auto; }
.pj-tagpick:empty::after { content: 'Every tag already belongs to a project.'; color: var(--color-text-muted); font-size: var(--text-sm); }
.pj-help { color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1.5; margin: 6px 0 0; }

/* ---- Detail: two columns — the work left, the CFO panel right ---- */
.pj-detail { display: flex; gap: 32px; align-items: flex-start; }
.pj-detail__main { flex: 1; min-width: 0; }
.pj-detail__aside { width: 400px; flex: none; }
@media (max-width: 1020px) { .pj-detail { flex-direction: column; } .pj-detail__aside { width: 100%; } }

.pj-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 24px; margin-bottom: 8px; }
.pj-meta dt { color: var(--color-text-muted); font-size: var(--text-xs); margin-bottom: 3px; }
.pj-meta dd { margin: 0; font-size: var(--text-base); }

.pj-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* task list — checkbox · label · assignee · due */
.pj-tasks .row-card { gap: 12px; }
.pj-task__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* row-card cells are white-space:nowrap — without the clip the label ran UNDER the assignee (Peter's screenshot, 22 Aug) */
.pj-task--done .pj-task__label { color: var(--color-text-muted); text-decoration: line-through; }
.pj-task__meta { color: var(--color-text-muted); font-size: var(--text-sm); white-space: nowrap; }

/* ---- The CFO panel — plain sentences, not KPI labels ---- */
.pj-cfo { border: var(--border-width) solid var(--color-border); border-radius: 14px; padding: 24px; background: var(--color-surface); box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow-x: clip; }   /* the hover tooltips are laid out even at opacity 0 — without the clip they widen the PAGE on a phone (132px h-scroll, caught at 390px) */
.pj-cfo__title { font-size: var(--text-base); font-weight: var(--weight-bold); margin: 0 0 6px; }
.pj-cfo__sub { color: var(--color-text-muted); font-size: var(--text-sm); margin: 0 0 16px; }
.pj-cfo__flag { display: flex; gap: 8px; align-items: baseline; font-size: var(--text-base); line-height: 1.55; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 10px; background: #fdf3e7; }
.pj-cfo__flag--bad { background: #fdecec; }
.pj-cfo__flag::before { content: '!'; font-weight: var(--weight-bold); flex: none; }
.pj-cfo__item { font-size: var(--text-base); line-height: 1.6; margin: 0; padding: 12px 0; border-bottom: var(--border-width) solid var(--color-border); }
.pj-cfo__item:last-child { border-bottom: none; padding-bottom: 0; }
/* every number is hoverable — the dotted underline says "there's a calculation here" */
.pj-num { font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; text-decoration: underline dotted var(--color-border-strong); text-underline-offset: 3px; cursor: help; }
/* inside a Home-grammar card the sentence is muted — the figure is the one dark thing */
.dcard__line .pj-num { color: var(--color-text); }
.dcard__fig .pj-num { text-decoration: none; }

/* one rhythm on the detail page (Peter, 22 Aug: "spacing is shit"): 40px between
   sections, 14px from a heading to its content, 10px between cards — the .rows
   default gap is the Figma list scale and doubled up here */
.pj-tasks.rows, .pj-activity.rows { gap: 10px; }

/* ---- Empty state (step j): one line + a styled CFO preview + the button ---- */
.pj-empty { max-width: 560px; margin: 24px auto 0; text-align: center; }
.pj-empty__line { font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.6; margin-bottom: 24px; }
.pj-empty .pj-cfo { text-align: left; margin-bottom: 28px; }

/* required-field flag on the create drawer (shared .is-missing convention) */
.input.is-missing { border-color: var(--color-danger); }


/* ---- Projects home rows: COLUMNS LINE UP (Peter, 24 Aug — "the name of the
   project… aren't quite aligned, so they look a bit off"). The client cell was
   hugging its text, so every project name started at a different x and the
   amounts drifted with the status pill's width. Fixed slots, the same way
   #inv-list sizes its Paid/Left/Total cells. ---- */
.pj-rows .pj-trunc--client { width: 200px; max-width: 200px; flex: none; }
.pj-rows .row-card__cell--amount { min-width: 104px; text-align: right; flex: none; }
.pj-rows .status-pill { min-width: 96px; justify-content: center; flex: none; }
/* the standard heading→list gap (tax-dashboard's --space-4); it was 2px */
#pj-rows-wrap > .section-title { margin-bottom: var(--space-4); }
