/* ===== «الحاسبة» — products + bill window (price-calc.js, price-calc-products.js) + «إنشاء عقد» sheet (price-calc-contract.js) ===== */
body.pcc-lock { overflow: hidden; }
.pcc { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 18px; animation: pcc-in .18s ease-out; }
@keyframes pcc-in { from { opacity: 0; } }
.pcc-win { width: min(1240px, 100%); height: min(860px, 100%); background: #fff; border-radius: 18px; box-shadow: 0 24px 70px rgba(15, 23, 42, .3); display: flex; flex-direction: column; overflow: hidden; }
.pcc-h { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.pcc-h h3 { margin: 0; font-size: 1.1rem; flex: 1; }
.pcc-tabs { display: none; background: #eef1f5; border-radius: 10px; padding: 3px; gap: 2px; }
.pcc-tabs button { border: 0; background: transparent; padding: .4rem .8rem; border-radius: 8px; font: inherit; font-size: .84rem; font-weight: 800; color: var(--muted); cursor: pointer; }
.pcc-tabs small { background: var(--orange); color: #fff; border-radius: 99px; padding: 0 .4rem; font-size: .7rem; }
.pcc-tabs small:empty { display: none; }
.pcc[data-view="prod"] .pcc-tabs [data-view="prod"], .pcc[data-view="bill"] .pcc-tabs [data-view="bill"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.pcc-x { border: 0; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; flex: none; transition: background .15s, color .15s; }
.pcc-x:hover { background: #fee2e2; color: var(--red); }
.pcc-close:hover { background: #f1f5f9; color: var(--ink); }
.pcc-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 430px; }
.pcc-prod { min-height: 0; display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); background: #f8fafc; }
.pcc-bill { min-height: 0; display: flex; flex-direction: column; }
.pcc-bh { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px 0; }
.pcc-bh h4 { margin: 0; font-size: .98rem; }
.pcc-bh small { color: var(--muted); font-weight: 700; }
.pcc-mbar { display: none; }
.pcc-b { flex: 1; overflow-y: auto; padding: 12px 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.pcc input { font: inherit; font-size: .88rem; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem; background: #fff; min-width: 0; width: 100%; transition: border-color .15s; }
.pcc input:focus { outline: 0; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(247, 147, 30, .14); }
.pcc input[type="date"] { padding-inline: .35rem; font-size: .8rem; }
.pcc label { display: flex; flex-direction: column; gap: 3px; font-size: .74rem; font-weight: 700; color: var(--muted); min-width: 0; }
.pcc-empty { display: flex; flex-direction: column; gap: 6px; text-align: center; padding: 26px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: .86rem; line-height: 1.8; }
.pcc-empty b { color: var(--ink); font-size: .95rem; }
.pcc-lines { display: flex; flex-direction: column; gap: 8px; }
.pcc-line { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fcfcfd; }
.pcc-line-h { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 8px; }
.pcc-line-h > div { flex: 1; min-width: 0; }
.pcc-line-h b { display: block; font-size: .9rem; line-height: 1.5; }
.pcc-line-h small { display: block; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.pcc-q { display: grid; grid-template-columns: 1.2fr .8fr .8fr 1.4fr; gap: 6px; align-items: end; }
.pcc-line:not(:has(label:nth-of-type(3))) .pcc-q { grid-template-columns: 1.2fr .9fr 1.6fr; }
.pcc-unit { display: flex; flex-direction: column; font-size: .82rem; padding-bottom: .3rem; white-space: nowrap; }
.pcc-unit small { color: var(--muted); font-size: .72rem; }
.pcc-line-t { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); text-align: end; font-size: .88rem; }
.pcc-line-t small { color: var(--muted); }
.pcc-set { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.pcc-sum { display: flex; flex-direction: column; gap: 2px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.pcc-row { display: flex; align-items: baseline; gap: 6px; font-size: .88rem; padding: 3px 0; }
.pcc-row > span { flex: 1; color: var(--muted); font-weight: 700; }
.pcc-row small { color: var(--muted); font-size: .72rem; }
.pcc-total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; font-size: 1rem; }
.pcc-total > span { color: var(--ink); }
.pcc-total b { font-size: 1.3rem; color: #c2410c; }
.pcc-warn { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 6px 8px; font-size: .78rem; line-height: 1.6; }
.pcc-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }
.pcc-go { flex: 1; justify-content: center; }
/* products */
.pcp-f { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); background: #fff; }
.pcc .pcp-q, .pcp-sel select { font: inherit; font-size: .9rem; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.pcc .pcp-q:focus, .pcp-sel select:focus { outline: 0; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(247, 147, 30, .14); }
.pcp-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pcp-kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.pcp-kinds button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .3rem .75rem; font: inherit; font-size: .8rem; font-weight: 800; color: var(--muted); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.pcp-kinds button small { font-weight: 700; opacity: .75; }
.pcp-kinds button:hover { border-color: #cbd5e1; color: var(--ink); }
.pcp-kinds button.is-on { background: #1b2027; border-color: #1b2027; color: #fff; }
.pcp-list { flex: 1; overflow-y: auto; padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.pcp-g { flex: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pcp-g h5 { margin: 0; padding: 9px 12px; font-size: .9rem; background: #fcfcfd; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.pcp-g h5 small { color: var(--muted); font-weight: 700; font-size: .74rem; }
.pcp-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; border: 0; border-top: 1px solid #f1f5f9; background: #fff; padding: 9px 12px; font: inherit; cursor: pointer; transition: background .15s; }
.pcp-g h5 + .pcp-row { border-top: 0; }
.pcp-row:hover { background: #fff7ed; }
.pcp-row.is-flash { background: #ffedd5; }
.pcp-opt { flex: 1; min-width: 0; font-size: .86rem; line-height: 1.5; }
.pcp-opt b, .pcp-opt small { display: block; }
.pcp-opt small { color: var(--muted); font-size: .75rem; }
.pcp-st { font-style: normal; font-size: .7rem; font-weight: 800; color: #b91c1c; background: #fee2e2; border-radius: 99px; padding: 0 .45rem; }
.pcp-pr { text-align: end; font-size: .84rem; white-space: nowrap; }
.pcp-pr small { color: var(--muted); font-size: .72rem; margin-inline-start: 2px; }
.pcp-pr i { display: block; font-style: normal; color: var(--muted); font-size: .72rem; }
.pcp-add { flex: none; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; font-weight: 800; font-size: 1.05rem; }
.pcp-row.is-in .pcp-add { background: var(--orange); border-color: var(--orange); color: #fff; font-size: .82rem; }
.pcp-more { align-self: center; }
.pcp-empty { color: var(--muted); text-align: center; padding: 30px 12px; margin: 0; }

@media (max-width: 860px) {
  .pcc { padding: 0; }
  .pcc-win { height: 100%; border-radius: 0; }
  .pcc-tabs { display: inline-flex; }
  .pcc-body { grid-template-columns: 1fr; }
  .pcc-prod { border: 0; }
  .pcc[data-view="prod"] .pcc-bill, .pcc[data-view="bill"] .pcc-prod { display: none; }
  .pcc[data-view="prod"] .pcc-mbar:not([hidden]) { display: flex; align-items: baseline; gap: 6px; border: 0; background: #1b2027; color: #fff; font: inherit; padding: 12px 16px; cursor: pointer; }
  .pcc-mbar span { flex: 1; text-align: start; color: #cbd5e1; font-size: .84rem; }
  .pcc-mbar b { font-size: 1.1rem; }
  .pcc-mbar i { font-style: normal; color: var(--orange); font-weight: 800; margin-inline-start: 8px; }
}
@media (max-width: 480px) {
  .pcc-q, .pcc-line:not(:has(label:nth-of-type(3))) .pcc-q { grid-template-columns: 1fr 1fr; }
  .pcc-unit { grid-column: 1 / -1; flex-direction: row; gap: 4px; align-items: baseline; padding: 0; }
}

/* «إنشاء عقد» sheet */
.pcx { padding: 18px 20px; }
.pcx h3 { margin: 0 0 4px; }
.pcx-sum { margin: 0 0 14px; color: var(--muted); font-size: .86rem; }
.pcx-sum b { color: var(--ink); }
.pcx-l { display: block; font-weight: 800; font-size: .84rem; margin-bottom: 4px; }
#pcx_pick { position: relative; }
#pcx_pick input, .pcx-newf input { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; }
#pcx_pick input:focus, .pcx-newf input:focus { outline: 0; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(247, 147, 30, .14); }
.pcx-new { margin-top: 8px; }
.pcx-newf { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
.pcx-chip { display: flex; align-items: center; gap: 10px; border: 1px solid #fed7aa; background: #fff7ed; border-radius: 12px; padding: 10px 12px; }
.pcx-chip > span { flex: 1; min-width: 0; }
.pcx-chip b { display: block; }
.pcx-chip small { color: var(--muted); font-size: .76rem; }
.pcx-err { margin-top: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 12px; font-size: .84rem; line-height: 1.7;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pcx-err[hidden] { display: none; }
.pcx-err > b { flex-basis: 100%; }
.pcx-acts { display: flex; gap: 8px; margin-top: 16px; }
.pcx-hint { margin: 12px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.7; }
@media (max-width: 480px) { .pcx-newf { grid-template-columns: 1fr; } }
