/* Section: المشاريع (P5, on the API; P6 adds the open tasks' «كل مهام المشروع» link, .pj-more). From the approved
   demo's projects.css. Only the :root tokens from app.css; every class starts with "pj-". Bars are sized through
   CSSOM (the CSP blocks style attributes). Mobile first. */

/* ------------------------------------------------------------ summary: totals, bars, notices */

/* On a phone the boxes are about 130px wide inside: a big amount (220,000.00 ر.س) drops its «ر.س» to the next
   line instead of spilling out of its box. */
.pj-totals .total-value {
  font-size: 18px;
}

.pj-totals .total-value .money {
  white-space: normal;
}

.pj-total-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.pj-unknown {
  color: var(--muted);
}

.pj-progress {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pj-progress-text {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pj-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.pj-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--ok);
}

.pj-bar-mini {
  height: 6px;
  margin-top: 8px;
}

.pj-sub-line {
  overflow-wrap: anywhere;
}

.pj-late-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 900;
}

.pj-late-list {
  margin: 0;
  padding-inline-start: 20px;
}

.pj-late-list li {
  margin: 2px 0;
  overflow-wrap: anywhere;
}

.pj-sched .row {
  min-height: 60px;
}

/* «لمين انصرف»: one line per payee with a bar. */
.pj-payees {
  padding-block: 4px;
}

.pj-payee {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.pj-payee:last-child {
  border-bottom: 0;
}

.pj-payee-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.pj-payee-name {
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.pj-payee .pj-bar-fill {
  background: var(--brand);
}

a.btn.pj-more {
  margin-top: 10px;
  text-decoration: none;
}

/* ------------------------------------------------------------ participants on the project screen */

.pj-shares {
  padding-block: 4px;
}

.pj-share {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.pj-share:last-child {
  border-bottom: 0;
}

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

.pj-share-who {
  flex: 1;
  min-width: 0;
}

.pj-share-name {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pj-share-pct {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pj-share-state {
  margin-inline-start: auto;
}

.pj-share-nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.pj-num {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.pj-num-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pj-num .money {
  font-size: 16px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pj-meta {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.btn.pj-delete {
  color: var(--late);
}

.btn.pj-delete:hover:not(:disabled) {
  border-color: var(--late);
}

.pj-link {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pj-notes {
  white-space: pre-wrap;
  font-weight: 600;
}

.pj-form-intro {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
}

.pj-form-intro strong {
  color: var(--text);
}

/* ------------------------------------------------------------ comments («التعليقات») */

.pj-comments {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pj-comment {
  margin: 0;
}

.pj-comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
}

.pj-comment-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.pj-comment-actions {
  display: flex;
  gap: 6px;
  margin-inline-start: auto;
}

.pj-comment-text {
  margin: 10px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.8;
}

/* The shared files block, made compact inside a comment: no heading, files on the page colour. */
.pj-comment .attachments {
  margin-top: 12px;
}

.pj-comment .attachments > .group-title {
  display: none;
}

.pj-comment .file {
  background: var(--bg);
  box-shadow: none;
}

/* ------------------------------------------------------------ shares and schedule editors (in the forms) */

.pj-editor {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.pj-editor > .btn {
  align-self: flex-start;
}

.pj-editor-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pj-editor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  padding-inline-start: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.pj-editor-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

/* The field is dir="ltr" so the % sits to the right of the number, as in "40 %". */
.pj-pct-field {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  width: 124px;
}

.pj-pct-input {
  min-width: 0;
  border-start-end-radius: 0;
  border-end-end-radius: 0;
  font-size: 19px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pj-pct-input.is-bad,
.pj-sched-row .input.is-bad {
  border-color: var(--late);
  background: var(--late-soft);
}

.pj-pct-unit {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1.5px solid var(--field-line);
  border-inline-start: 0;
  border-start-end-radius: var(--radius-sm);
  border-end-end-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  font-weight: 800;
}

.pj-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  color: var(--muted);
}

.pj-lock .icon svg {
  width: 22px;
  height: 22px;
}

.pj-editor-total {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 800;
}

.pj-editor-total.is-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pj-editor-total.is-bad {
  background: var(--late-soft);
  color: var(--late);
}

.pj-editor-left {
  font-size: 15px;
}

.pj-sched-total {
  font-size: 16px;
}

.pj-sched-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* [name ×] on the first line, [date | amount] on the second. The form dialog is at most 560px wide even on a
   desktop, which is too narrow for all four on one line (the date picker would be clipped). */
.pj-sched-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  grid-template-areas:
    'name name x'
    'due amount amount';
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.pj-sched-name {
  grid-area: name;
}

.pj-sched-x {
  grid-area: x;
  align-self: end;
}

.pj-sched-due {
  grid-area: due;
}

.pj-sched-amount {
  grid-area: amount;
}

.pj-sched-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pj-sched-cap {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pj-sched-row .input {
  min-width: 0;
}

.pj-sched-row .pj-sched-date {
  padding-inline: 10px;
  font-size: 16px;
}

.pj-sched-row .money-field .input {
  font-size: 18px;
}
