/* app-deeds.css: محرر العقود ومعاينة الطباعة وورقة المكتب. الملفات تُحمَّل بالترتيب: app.css, app-theme.css, app-motion.css, app-deeds.css, app-extras.css, app-lit.css, app-petitions.css */
/* contract builder: form on one side, clauses on the other; fixed clauses read as settled text, open ones as fields */
.dtypes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.dgh {
  margin: 18px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mute);
}
.dgh:first-child,
.dh + .dnew + p + .dgh {
  margin-top: 4px;
}
.dtypes .catb {
  padding: 18px 12px;
  text-align: center;
  gap: 6px;
}
.dtypes .catb .mute {
  font-size: 12px;
  line-height: 1.55;
}
.dlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dcard {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  transition:
    border-color var(--t),
    box-shadow var(--t),
    transform var(--t-fast) var(--ease-out);
}
.dcard:hover {
  border-color: color-mix(in srgb, var(--acc) 30%, var(--line));
}
.dic {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--acc2);
  color: var(--acc);
}
.dic .ico {
  width: 22px;
  height: 22px;
  stroke-width: 1.7;
}
.dmain b {
  display: block;
}
.dmain .mute {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dtitle {
  font: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  padding: 2px 8px;
  margin-right: -9px;
  width: min(640px, 100%);
  min-width: 0;
  color: var(--ink);
}
.dtitle:hover {
  border-color: var(--line);
}
.dtitle:focus {
  outline: 0;
  border-color: var(--acc);
  background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 15%, transparent);
}
.top:has(.dtitle) h1 {
  flex: 1;
  min-width: 0;
}
#dsave {
  font-size: 12.5px;
  min-width: 64px;
}
.deedg {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.dform {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 98px);
  overflow: auto;
  padding: 4px 20px 16px;
  overscroll-behavior: contain;
}
.dsec {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.dsec:last-child {
  border: 0;
}
.dsec h5 {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.dpick select {
  font-size: 12.5px;
  padding: 4px 8px;
  max-width: 180px;
  color: var(--mute);
  font-weight: 400;
}
.dsec > label.row {
  margin: 6px 0;
  font-size: 13px;
}
.dgrid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dgrid2 > * {
  min-width: 0;
}
.dgrid2 input,
.dgrid2 select {
  width: 100%;
}
.dgrid2 > .full,
.dgrid2 .fl:has([data-dk$="_name"]),
.dgrid2 .fl:has([data-dk$="_addr"]),
.dgrid2 .fl:has([data-dk="loc"]),
.dgrid2 .fl:has([data-dk="works"]),
.dgrid2 .fl:has([data-dk="goods"]),
.dgrid2 .fl:has([data-dk="subject"]),
.dgrid2 .fl:has([data-dk="purpose"]),
.dgrid2 .fl:has([data-dk="project"]),
.dgrid2 .fl:has([data-dk="scope"]),
.dgrid2 .fl:has([data-dk="items"]),
.dgrid2 .fl:has([data-dk="service"]),
.dgrid2 .fl:has([data-dk="deliverables"]),
.dgrid2 .fl:has([data-dk^="contrib"]) {
  grid-column: 1/-1;
}
.dclauses {
  min-width: 0;
}
.cls {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cl {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 18px 16px;
  box-shadow: var(--shadow);
  transition: border-color var(--t);
}
.cl:focus-within {
  border-color: color-mix(in srgb, var(--acc) 40%, var(--line));
}
.cl.fixed {
  background: color-mix(in srgb, var(--acc2) 50%, var(--panel));
}
.clh {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.cln {
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}
.clt {
  font-weight: 600;
  flex: 1;
  min-width: 0;
}
input.clt {
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 8px;
  border-radius: 8px;
  margin-right: -8px;
}
input.clt:hover {
  border-color: var(--line);
}
.lk {
  display: inline-flex;
}
.lk .ico {
  width: 14px;
  height: 14px;
  color: var(--mute);
}
.clx {
  display: flex;
  gap: 2px;
  opacity: 0.45;
  transition: opacity var(--t);
}
.cl:hover .clx,
.cl:focus-within .clx {
  opacity: 1;
}
.clx .x:disabled {
  visibility: hidden;
}
.clp {
  margin: 0;
  line-height: 2.05;
  text-align: justify;
}
.clta {
  width: 100%;
  resize: none;
  line-height: 1.95;
  min-height: 72px;
  overflow: hidden;
  background: var(--panel);
}
.fv {
  font-weight: 600;
  color: var(--acc);
}
.ph {
  border: 0;
  border-bottom: 1.5px dashed var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  color: var(--warn);
  font: inherit;
  font-size: 0.9em;
  padding: 0 6px;
  border-radius: 5px 5px 0 0;
  cursor: pointer;
  transition: background-color var(--t);
}
.ph:hover {
  background: color-mix(in srgb, var(--warn) 17%, transparent);
}
.clnew {
  margin: 12px 0 10px;
}
.clopt {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.clopt .chip {
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  transition:
    background-color var(--t),
    color var(--t);
}
.clopt .chip:hover {
  background: var(--acc2);
  color: var(--acc);
}
.fl.flash input {
  animation: fieldflash 1.2s var(--ease-out);
}
@keyframes fieldflash {
  20% {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 45%, transparent);
  }
}
.dtypes.c4 {
  grid-template-columns: repeat(4, 1fr);
}
.dcustom {
  width: 100%;
  justify-content: center;
  margin-top: 16px;
  height: 44px;
  border-style: dashed;
  color: var(--mute);
}
.dcustom:hover {
  color: var(--acc);
}
.dprint {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.dprint .btn {
  height: 42px;
  padding: 0 20px;
}
.dcard .btn.sm {
  white-space: nowrap;
}
.clprev {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--acc2) 55%, transparent);
  font-size: 13px;
}
.clx .x .ico {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
}
.pvw {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.pvw {
  position: relative;
  height: 66vh;
}
.pvw iframe {
  position: absolute;
  top: 0;
  right: calc((100% - 794px * var(--s, 1)) / 2);
  width: 794px;
  height: calc(66vh / var(--s, 1));
  border: 0;
  transform: scale(var(--s, 1));
  transform-origin: top right;
}
.pvtop {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.pvtop h3 {
  margin: 0;
  font-size: 17px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pvback {
  flex: none;
}
.pvact {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pvact .btn {
  height: 40px;
}
.pvact .btn .ico,
.pvback .ico {
  width: 17px;
  height: 17px;
}
.pvnote {
  margin: 8px 0 10px;
  font-size: 12.5px;
  min-height: 1.2em;
}
.pdfjob {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  bottom: 0;
  left: 0;
  border: 0;
}
.dnew {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 6px;
}
.dnew > * {
  min-width: 0;
}
.dnew select {
  width: 100%;
}
.lhcard .dgrid2 {
  margin-bottom: 4px;
}
.lhprev {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  height: 300px;
  margin-top: 14px;
}
.lhprev iframe {
  position: absolute;
  top: 0;
  right: 0;
  width: 794px;
  height: 900px;
  border: 0;
  transform-origin: top right;
  transform: scale(var(--s, 0.5));
  pointer-events: none;
}
@media (max-width: 1100px) {
  .deedg {
    grid-template-columns: 1fr;
  }
  .dform {
    position: static;
    max-height: none;
  }
}
@media (max-width: 860px) {
  .dtypes,
  .dtypes.c4 {
    grid-template-columns: 1fr 1fr;
  }
  .pvact {
    display: grid;
    grid-template-columns: 1fr;
  }
  .pvact .btn {
    height: 46px;
    justify-content: center;
  }
  .pvw {
    height: 54vh;
  }
  .pvw iframe {
    height: calc(54vh / var(--s, 1));
  }
  .dcard .btn.sm {
    display: none;
  }
  .dcard {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .dcard .chip,
  .dcard .dwhen {
    display: none;
  }
  .dgrid2,
  .dnew {
    grid-template-columns: 1fr;
  }
  .cl {
    padding: 12px 14px 14px;
  }
  .clx {
    opacity: 1;
  }
  .lhprev {
    height: 200px;
  }
}

/* أشخاص الطرف في محرر العقد: «شخص / شركة»، ورقم كل شخص حين يكونون أكثر من واحد */
.dperson + .dperson {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.dph {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--mute);
  margin-bottom: 4px;
}
.dkind {
  display: flex;
  gap: 16px;
  margin: 0 0 8px;
  font-size: 14px;
}
.dkind label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.dsec > .btn.sm {
  margin-top: 10px;
}
.dside {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
