/* projects module styles — tokens from app.css only, no raw hex.
   pj-*  projects page + project detail
   cs-*  printable call sheet (always white paper, colors derived from currentColor) */

/* ───────── toolbar ───────── */
.pj-filter { display: block; flex: 0 1 180px; min-width: 140px; }
.pj-filter .input { width: 100%; }
.pj-checks { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 0 2px; }
.pj-gap { margin-bottom: 12px; }
.pj-center { justify-content: center; }

/* ───────── board cards ───────── */
.pj-card { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pj-card-title { font-weight: 700; font-size: 13.5px; line-height: 1.3; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.pj-card-title:hover { color: var(--red-ink); }
.pj-card-client { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); min-width: 0; }
.pj-card-facts { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-2); }
.pj-fact { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.pj-fact .icon { opacity: 0.75; }
.pj-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; }
.pj-card-progress { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 110px; min-width: 70px; }
.pj-card-progress .progress { flex: 1; }
.pj-card-status { margin-top: 2px; }
.pj-status-select { height: 28px; font-size: 12.5px; padding-left: 8px; cursor: pointer; }
.pj-status-inline { width: auto; min-width: 140px; }
/* Mouse users drag; the status picker appears on hover / keyboard focus. Touch always sees it. */
@media (hover: hover) and (pointer: fine) {
  .pj-card-status { display: none; }
  .kanban-card:hover .pj-card-status, .kanban-card:focus-within .pj-card-status { display: block; }
}

/* ───────── detail header ───────── */
.pj-client-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.pj-usage-callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.pj-usage-callout.tone-red { border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.pj-usage-callout.tone-amber { border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.pj-usage-callout strong { color: var(--text); }
.pj-usage-notes { color: var(--text-2); font-size: 13px; margin-top: 3px; }

.pj-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.pj-fact-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pj-fact-val { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; line-height: 1.3; }
@media (max-width: 640px) {
  .pj-facts { gap: 8px; }
  .pj-fact-box { padding: 10px 12px; }
  .pj-fact-val { font-size: 14px; }
}
.pj-fact-sub { font-size: 12.5px; color: var(--muted); }

/* ───────── overview ───────── */
.pj-brief { font-size: 14px; line-height: 1.6; color: var(--text-2); max-height: 560px; overflow-y: auto; }
.pj-address { font-weight: 600; overflow-wrap: anywhere; }
.pj-link-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.pj-link-row:last-child { border-bottom: 0; }
.pj-link-label { font-size: 12px; color: var(--muted); width: 104px; flex: none; }
.pj-linkbtn { background: none; border: 0; padding: 0; color: var(--red-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pj-crew-role { display: grid; grid-template-columns: 24px 130px minmax(0, 1fr); gap: 10px; align-items: center; }
.pj-crew-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────── tables ───────── */
.pj-table-card .table td:first-child { min-width: 190px; }
.table .pj-status-select { min-width: 132px; }
.pj-deliv-progress { padding: 4px 16px 12px; }
.pj-row-actions { justify-content: flex-end; }
.pj-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 42ch; }
.pj-flush { margin: 0 -16px -16px; border-top: 1px solid var(--border); }
.pj-flush .table th:first-child, .pj-flush .table td:first-child { padding-left: 16px; }
.pj-flush .table th:last-child, .pj-flush .table td:last-child { padding-right: 16px; }
.pj-hours-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pj-hours-chips .chip strong { color: var(--text); font-weight: 600; }
.pj-chip-total { background: var(--red-soft); color: var(--text); }

/* ───────── money ───────── */
.pj-money-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pj-money-grid .stat { background: var(--surface-2); }
.pj-note { margin-top: 12px; color: var(--muted); }

/* ───────── schedule ───────── */
.pj-sched { display: flex; flex-direction: column; gap: 24px; }
.pj-sched-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pj-sched-list { display: flex; flex-direction: column; gap: 8px; }
.pj-sched-item { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.pj-sched-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pj-sched-item.is-tbd .pj-datebox { border-style: dashed; }
.pj-datebox { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); padding: 6px 0; line-height: 1.05; }
.pj-datebox.is-today { background: var(--red-soft); border-color: var(--red); color: var(--red-ink); }
.pj-datebox.is-today .pj-dow, .pj-datebox.is-today .pj-mon { color: var(--red-ink); }
.pj-dow, .pj-mon { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pj-day { font-size: 20px; font-weight: 800; margin: 3px 0; font-variant-numeric: tabular-nums; }
.pj-sched-main { display: flex; flex-direction: column; min-width: 0; }
.pj-sched-title { font-weight: 700; overflow-wrap: anywhere; }
.pj-sched-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12.5px; margin-top: 3px; min-width: 0; }
.pj-sched-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pj-sched-empty { color: var(--muted); font-size: 13px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ───────── responsive ───────── */
@media (max-width: 1100px) {
  .pj-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pj-filter { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .pj-checks { flex: 1 1 100%; }
  .pj-sched-item { grid-template-columns: 46px minmax(0, 1fr); gap: 10px; padding: 10px 12px; }
  .pj-sched-side { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
  .pj-crew-role { grid-template-columns: 24px minmax(0, 1fr); }
  .pj-crew-role .input { grid-column: 1 / -1; }
  .pj-link-label { width: 88px; }
}

/* ───────── call sheet ─────────
   Paper is white via .print-page (app.css). Every line/muted color below is mixed from
   currentColor so it reads on white in both the dark and the light theme. */
.call-sheet-wrap { min-height: 100vh; background: var(--bg); padding-bottom: 40px; }
.pj-cs-state { max-width: 640px; margin: 40px auto; padding: 0 16px; }
.call-sheet {
  --cs-line: color-mix(in srgb, currentColor 24%, transparent);
  --cs-line-soft: color-mix(in srgb, currentColor 11%, transparent);
  --cs-muted: color-mix(in srgb, currentColor 64%, transparent);
  max-width: 880px; margin: 24px auto 0; border-radius: 12px; box-shadow: var(--shadow); min-height: 0;
}
.call-sheet a { color: inherit !important; text-decoration: underline; text-decoration-color: var(--cs-line); text-underline-offset: 2px; }
.call-sheet h1, .call-sheet h2 { color: inherit; }
.cs-muted { color: var(--cs-muted); }
.cs-strong { font-weight: 700; }
.cs-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.cs-gap { margin-top: 8px; }
.cs-url { display: none; }
.cs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 14px; border-bottom: 3px solid var(--red); flex-wrap: wrap; }
.cs-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cs-brand img { height: 36px; width: auto; }
.cs-company { font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; font-size: 13px; }
.cs-brand .cs-muted { font-size: 12px; }
.cs-title-block { text-align: right; }
.cs-title-block .cs-muted { font-size: 11.5px; margin-top: 4px; }
.cs-title { font-weight: 800; font-size: 22px; line-height: 1; font-variation-settings: 'wdth' 120; letter-spacing: 0.1em; text-transform: uppercase; }
.cs-hero { padding: 18px 0 6px; }
.cs-project { font-size: 27px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.cs-client { font-size: 15px; font-weight: 600; margin-top: 4px; }
.cs-warn { display: flex; gap: 10px; align-items: flex-start; border: 2px solid var(--red); background: var(--red-soft); border-radius: 8px; padding: 10px 12px; margin: 12px 0 4px; font-weight: 700; }
.cs-warn .icon { color: var(--red); margin-top: 1px; }
.cs-warn.is-amber { border-color: var(--amber); background: var(--amber-soft); }
.cs-warn.is-amber .icon { color: currentColor; }
.cs-warn-notes { font-weight: 500; margin-top: 3px; }
.cs-keys { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; border: 1px solid var(--cs-line); border-radius: 8px; margin: 14px 0 4px; }
.cs-key { padding: 10px 12px; border-right: 1px solid var(--cs-line); min-width: 0; }
.cs-key:last-child { border-right: 0; }
.cs-label { font: 600 10.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--cs-muted); margin-bottom: 5px; }
.cs-val { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.cs-grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.cs-block { margin-top: 18px; break-inside: avoid; page-break-inside: avoid; min-width: 0; }
.cs-block h2 { font: 700 11.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; padding-bottom: 6px; border-bottom: 1px solid var(--cs-line); margin-bottom: 8px; }
.cs-block p + p { margin-top: 4px; }
.cs-table-wrap { overflow-x: auto; }
.cs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cs-table th { text-align: left; font: 600 10.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--cs-muted); padding: 6px 8px; border-bottom: 1px solid var(--cs-line); }
.cs-table td { padding: 7px 8px; border-bottom: 1px solid var(--cs-line-soft); vertical-align: top; }
.cs-table th:first-child, .cs-table td:first-child { padding-left: 0; }
.cs-checklist { list-style: none; margin: 0; padding: 0; }
.cs-checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; border-bottom: 1px solid var(--cs-line-soft); }
.cs-checklist li:last-child { border-bottom: 0; }
.cs-box { width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; flex: none; margin-top: 3px; }
.cs-box.is-done { background: currentColor; }
.cs-brief { font-size: 13.5px; line-height: 1.6; }
.cs-foot { margin-top: 26px; padding-top: 10px; border-top: 1px solid var(--cs-line); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .call-sheet { margin: 0; border-radius: 0; padding: 20px 16px; box-shadow: none; }
  .cs-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-key:nth-child(2) { border-right: 0; }
  .cs-key:nth-child(-n + 2) { border-bottom: 1px solid var(--cs-line); }
  .cs-grid2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cs-project { font-size: 22px; }
  .cs-title-block { text-align: left; }
}

@media print {
  .call-sheet-wrap { background: none; min-height: 0; padding: 0; }
  .call-sheet { margin: 0; max-width: none; box-shadow: none; border-radius: 0; padding: 0; }
  .cs-keys { grid-template-columns: 2fr 1fr 1fr 1.4fr; }
  .cs-key { border-bottom: 0 !important; border-right: 1px solid var(--cs-line) !important; }
  .cs-key:last-child { border-right: 0 !important; }
  .cs-grid2 { grid-template-columns: 1.4fr 1fr; gap: 20px; }
  .cs-table-wrap { overflow: visible; }
  .call-sheet a { text-decoration: none; }
  .cs-url { display: block; font-size: 10px; overflow-wrap: anywhere; margin-top: 2px; }
  .cs-warn { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
