/* Projects list + detail. Layout follows the approved compact-list design; portal look:
   #1c1e1a ink, white cards, sharp corners, green #8cc63e only with black text, red #8a2a22 for danger. */
.pj { font-family: Inter, Arial, sans-serif; color: #1c1e1a; display: flex; flex-direction: column; gap: 16px; }
.pj *, .pj *::before, .pj *::after { box-sizing: border-box; }
.pj-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pj-bar { background: #fff; border: 1px solid #e7e5e4; padding: 14px 16px; }
.pj-bar-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.pj-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.pj-field-grow { flex: 1 1 260px; }
.pj-label-text { font-size: 13px; font-weight: 600; color: #57534e; }
.pj-input { height: 48px; border: 1px solid #d6d3d1; background: #fff; font: inherit; font-size: 14px; color: #1c1e1a; padding: 0 10px; border-radius: 0; width: 100%; margin: 0; }
.pj-input:focus { outline: 2px solid #1c1e1a; outline-offset: -1px; border-color: #1c1e1a; }
.pj-textarea, .pj-item-notes { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.pj-select { width: 190px; }
.pj-tabs { display: flex; border: 1px solid #d6d3d1; height: 40px; }
.pj-tab { border: 0; background: #fff; font: inherit; font-size: 14px; padding: 0 16px; cursor: pointer; color: #1c1e1a; }
.pj-tab + .pj-tab { border-left: 1px solid #d6d3d1; }
.pj-tab.is-on { background: #1c1e1a; color: #fff; }
.pj-new { margin-left: auto; height: 40px; }
.pj-results { display: flex; justify-content: space-between; align-items: center; }
.pj-count { font-size: 14px; font-weight: 600; }
.pj-status:empty { display: none; }
.pj-msg { margin: 0; padding: 12px 14px; background: #fff; border: 1px solid #e7e5e4; font-size: 14px; }
.pj-msg[hidden] { display: none; }
.pj-msg-error { background: #fbeceb; border-color: #f0cfcb; color: #8a2a22; }
.pj-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 16px; border: 1px solid #1c1e1a; background: #fff; color: #1c1e1a; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border-radius: 0; text-decoration: none; white-space: nowrap; }
.pj-btn:hover { background: #f5f5f4; }
.pj-btn-primary { background: #111; border-color: #111; color: #fff; }
.pj-btn-primary:hover { background: #2b2b2b; }
.pj-btn-danger { background: #8a2a22; border-color: #8a2a22; color: #fff; }
.pj-btn-danger:hover { background: #6f2019; }
.pj-btn:disabled { opacity: 0.6; cursor: default; }
.pj-link { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: #1c1e1a; text-decoration: underline; cursor: pointer; }
.pj-btn:focus-visible, .pj-link:focus-visible, .pj-tab:focus-visible, .pj-menu-trigger:focus-visible, .pj-menu-item:focus-visible, .pj-name:focus-visible, .pj-back:focus-visible, .pj-remove:focus-visible { outline: 2px solid #1c1e1a; outline-offset: 2px; }
.pj-empty { padding: 32px 16px; background: #fff; border: 1px solid #e7e5e4; text-align: center; color: #57534e; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pj-empty p { margin: 0; }

/* list */
.pj-list { border-top: 1px solid #d6d3d1; }
.pj-head, .pj-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 160px 48px; column-gap: 24px; align-items: center; }
.pj-head { padding: 12px 20px; background: transparent; border: 1px solid #e7e5e4; border-top: 0; font-size: 13px; font-weight: 600; color: #57534e; }
.pj-row { padding: 14px 20px; background: #fff; border: 1px solid #e7e5e4; border-top: 0; font-size: 14px; }
.pj-identity, .pj-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pj-name { font-size: 16px; font-weight: 600; color: #1c1e1a; text-decoration: none; overflow-wrap: anywhere; }
.pj-name:hover { text-decoration: underline; }
.pj-caption { font-size: 13px; color: #57534e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-mobile-label { display: none; }
.pj-menu { position: relative; justify-self: end; }
.pj-menu-trigger { width: 40px; height: 40px; border: 1px solid #d6d3d1; background: #fff; font-size: 20px; line-height: 1; cursor: pointer; color: #1c1e1a; border-radius: 0; }
.pj-menu-trigger:hover, .pj-menu-trigger[aria-expanded="true"] { border-color: #1c1e1a; }
.pj-menu-panel { position: absolute; right: 0; top: 44px; z-index: 20; width: 210px; background: #fff; border: 1px solid #1c1e1a; padding: 6px; display: flex; flex-direction: column; box-shadow: 0 6px 20px rgba(28, 30, 26, 0.12); }
.pj-menu-panel[hidden] { display: none; }
.pj-menu-item { display: flex; align-items: center; min-height: 40px; padding: 0 12px; background: none; border: 0; font: inherit; font-size: 14px; color: #1c1e1a; text-align: left; text-decoration: none; cursor: pointer; }
.pj-menu-item:hover { background: #f5f5f4; }
.pj-menu-item.is-danger { color: #8a2a22; }

/* dialogs */
.pj-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(28, 30, 26, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; font-family: Inter, Arial, sans-serif; color: #1c1e1a; }
.pj-dialog { background: #fff; width: 100%; max-width: 480px; padding: 24px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.pj-dialog *, .pj-dialog *::before, .pj-dialog *::after { box-sizing: border-box; }
.pj-dialog-title { margin: 0; font-family: Lora, Georgia, serif; font-weight: 600; font-size: 22px; }
.pj-dialog-text { margin: 0; font-size: 15px; line-height: 1.5; }
.pj-dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pj-fields { display: flex; flex-direction: column; gap: 14px; }
.pj-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.pj-optional { font-weight: 400; color: #57534e; }

/* detail */
.pj-back { align-self: flex-start; font-size: 14px; color: #1c1e1a; text-decoration: underline; }
.pj-detail { display: flex; flex-direction: column; gap: 16px; }
.pj-detail-head { background: #fff; border: 1px solid #e7e5e4; padding: 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.pj-detail-titles { min-width: 0; flex: 1 1 320px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pj-detail-title { margin: 0; font-family: Lora, Georgia, serif; font-weight: 600; font-size: 30px; line-height: 1.2; overflow-wrap: anywhere; }
.pj-detail-notes { margin: 0; font-size: 15px; color: #57534e; line-height: 1.5; white-space: pre-line; }
.pj-detail-summary { margin: 0; font-size: 13px; color: #57534e; }
.pj-detail-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pj-badge { display: inline-block; padding: 3px 8px; font-size: 12px; font-weight: 600; background: #f5f5f4; color: #57534e; }
.pj-items { background: #fff; border: 1px solid #e7e5e4; }
.pj-items-head, .pj-item { display: grid; grid-template-columns: minmax(0, 1.6fr) 100px minmax(0, 1fr) 80px; column-gap: 24px; align-items: start; }
.pj-items-head { padding: 12px 20px; background: transparent; border-bottom: 1px solid #e7e5e4; font-size: 13px; font-weight: 600; color: #57534e; }
.pj-item { padding: 16px 20px; border-bottom: 1px solid #e7e5e4; }
.pj-item:last-child { border-bottom: 0; }
.pj-item-product { display: flex; gap: 14px; min-width: 0; }
.pj-thumb { width: 72px; height: 72px; flex: 0 0 72px; object-fit: contain; background: #fff; border: 1px solid #e7e5e4; }
.pj-thumb-empty { display: flex; align-items: center; justify-content: center; background: #f5f5f4; color: #57534e; font-size: 14px; font-weight: 600; }
.pj-item-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pj-item-name { font-size: 15px; font-weight: 700; color: #1c1e1a; text-decoration: none; overflow-wrap: anywhere; }
.pj-item-name:hover { text-decoration: underline; }
.pj-item-sku { margin: 0; font-size: 13px; font-weight: 600; color: #57534e; }
.pj-item-spec { margin: 0; font-size: 13px; color: #57534e; line-height: 1.45; }
.pj-item-qty, .pj-item-notes-cell { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.pj-qty { width: 80px; }
.pj-saved { font-size: 12px; color: #57534e; min-height: 16px; }
.pj-remove { justify-self: end; background: none; border: 0; padding: 10px 0; font: inherit; font-size: 13px; color: #8a2a22; text-decoration: underline; cursor: pointer; }
.pj-print-only { display: none; }

@media (max-width: 767px) {
  .pj-new { margin-left: 0; width: 100%; }
  .pj-select { width: 100%; }
  .pj-field { flex: 1 1 100%; }
  .pj-head, .pj-items-head { display: none; }
  .pj-row { grid-template-columns: minmax(0, 1fr) 40px; row-gap: 8px; border-top: 0; }
  .pj-row .pj-identity { grid-column: 1; }
  .pj-row .pj-menu { grid-column: 2; grid-row: 1; }
  .pj-row .pj-cell { grid-column: 1 / -1; flex-direction: row; gap: 8px; flex-wrap: wrap; }
  .pj-mobile-label { display: inline; font-size: 12px; font-weight: 600; color: #57534e; }
  .pj-item { grid-template-columns: 1fr; row-gap: 12px; }
  .pj-remove { justify-self: start; padding: 0; }
  .pj-detail-head { padding: 18px; }
  .pj-detail-title { font-size: 24px; }
}

@media print {
  /* Print only the project. */
  body * { visibility: hidden !important; }
  .pj, .pj * { visibility: visible !important; }
  .pj { position: absolute; left: 0; top: 0; width: 100%; gap: 10px; }
  body > *:not(:has(.pj)) { display: none !important; }
  .pj-no-print, .pj-back, .pj-qty, .pj-item-notes, .pj-saved, .pj-add, .pj-status, .pj-remove, .pj-menu, .pj-dl { display: none !important; }
  .pj-detail .pj-items:not(.pj-items-shared) .pj-items-head span:last-child { display: none !important; }
  .pj-print-only { display: block; margin: 0; font-size: 14px; }
  .pj-print-head { display: flex !important; justify-content: space-between; font-size: 11px; color: #57534e; border-bottom: 1px solid #999; padding-bottom: 6px; }
  .pj-detail-head { padding: 0 0 8px; border: 0; }
  .pj-detail-title { font-size: 24px; }
  .pj-items { border-color: #999; }
  .pj-items-head, .pj-item { grid-template-columns: minmax(0, 1.6fr) 70px minmax(0, 1fr); padding: 8px 4px; }
  .pj-items-shared.pj-no-notes .pj-items-head, .pj-items-shared.pj-no-notes .pj-item { grid-template-columns: minmax(0, 1fr) 70px; }
  .pj-item { break-inside: avoid; }
  .pj-thumb { width: 52px; height: 52px; flex-basis: 52px; }
  .pj-item-name { color: #000; text-decoration: none; }
  @page { margin: 14mm; }
}

/* sharing */
.pj-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.pj-check input { width: 18px; height: 18px; margin: 0; accent-color: #1c1e1a; }
.pj-small { font-size: 13px; color: #57534e; }
.pj-copied { margin: 0; font-size: 13px; color: #2f4d12; min-height: 18px; }
.pj-push { flex: 1 1 auto; }
.pj-btn[hidden] { display: none; }
.pj-btn-danger-outline { background: #fff; border-color: #8a2a22; color: #8a2a22; }
.pj-btn-danger-outline:hover { background: #fbeceb; }
.pj-items-shared .pj-items-head, .pj-items-shared .pj-item { grid-template-columns: minmax(0, 1.6fr) 100px minmax(0, 1fr); }
.pj-items-shared.pj-no-notes .pj-items-head, .pj-items-shared.pj-no-notes .pj-item { grid-template-columns: minmax(0, 1fr) 100px; }
.pj-qty-text { font-size: 15px; font-weight: 600; padding-top: 2px; }
.pj-shared-note { margin: 0; font-size: 14px; color: #57534e; white-space: pre-line; }
@media (max-width: 767px) {
  .pj-items-shared .pj-item, .pj-items-shared.pj-no-notes .pj-item { grid-template-columns: 1fr; }
  .pj-item-qty { flex-direction: row; align-items: center; gap: 8px; }
}
.pj-checks { display: flex; flex-direction: column; gap: 10px; }

/* add by item number */
.pj-add { background: #fff; border: 1px solid #e7e5e4; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pj-add-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.pj-add-search { position: relative; }
.pj-add .pj-qty { width: 80px; }
.pj-add .pj-link { height: 40px; }
.pj-add-list { display: flex; flex-direction: column; gap: 10px; }
.pj-add-list[hidden] { display: none; }
.pj-add-msg { margin: 0; font-size: 13px; min-height: 0; }
.pj-add-msg:empty { display: none; }
.pj-add-msg.is-ok { color: #2f4d12; }
.pj-add-msg.is-error { color: #8a2a22; }
.pj-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid #1c1e1a; border-top: 0; max-height: 340px; overflow: auto; box-shadow: 0 6px 20px rgba(28, 30, 26, 0.12); }
.pj-suggest[hidden] { display: none; }
.pj-suggest-item { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f5f5f4; }
.pj-suggest-item:hover, .pj-suggest-item.is-active { background: #f5f5f4; }
.pj-suggest-sku { font-weight: 700; font-size: 14px; }
.pj-suggest-name { font-size: 14px; color: #1c1e1a; }
.pj-suggest-spec { grid-column: 1 / -1; font-size: 12px; color: #57534e; }
.pj-suggest-empty { padding: 10px 12px; font-size: 14px; color: #57534e; }
@media (max-width: 767px) { .pj-add-search { flex: 1 1 100%; } }

/* downloads */
.pj-dl { display: flex; gap: 8px; }
.pj-menu-btn { width: auto; font-size: 14px; }
.pj-detail-actions .pj-menu-panel { top: 44px; }
