/* ۴۰٫۲۲: پیمانکاریِ ساختمان — نیمهٔ دومِ رابط (construction2.js)
   شبکهٔ فشردهٔ ردیف‌های صورت‌وضعیت/چک‌لیست/نیروی کار، جعبه‌های امضا، زیرزبانه‌های کارگاه، خلاصهٔ مبالغ. */

/* --- شبکهٔ ردیف‌های ویرایش‌پذیر --- */
.cn-lines{overflow-x:auto}
.cn-lines table{width:100%;border-collapse:collapse;font-size:13.5px}
.cn-lines th,.cn-lines td{padding:4px 6px;vertical-align:middle;white-space:nowrap}
.cn-lines td:nth-child(2){white-space:normal;min-width:180px}
.cn-lines input,.cn-lines select{width:100%;min-width:72px;padding:5px 7px;font-size:13.5px;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--ink)}
.cn-lines input.numfmt{text-align:left;min-width:96px}
.cn-lines input:focus,.cn-lines select:focus{outline:2px solid var(--brand-soft);border-color:var(--brand)}
.cn-lines .ln-amt{text-align:left;direction:ltr;min-width:110px}
.cn-lines .ln-n{color:var(--muted);width:28px}
.cn-lines .btn.sm.danger{padding:2px 8px}

/* --- سرِ صورت‌وضعیت و خلاصهٔ مبالغ --- */
.cn2-head{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px 14px;margin-bottom:14px}
.cn2-ro{padding:7px 0;font-weight:600}
.cn2-tot{margin-top:16px;display:grid;grid-template-columns:minmax(0,1fr);gap:12px;max-width:620px;margin-inline-start:auto}
.cn2-sum{width:100%;border-collapse:collapse;font-size:13.5px}
.cn2-sum td,.cn2-sum th{padding:6px 8px;border-bottom:1px solid var(--line);text-align:right}
.cn2-sum td:last-child,.cn2-sum th:last-child{text-align:left;direction:ltr;white-space:nowrap}
.cn2-sum th{font-weight:700}
.cn2-ded thead th{color:var(--muted);font-weight:600;font-size:13.5px}
.cn2-ded input.ded-in{max-width:150px;text-align:left}
.cn2-ded input.ded-in:disabled{opacity:.55}
.cn2-ov{display:inline-flex;align-items:center;gap:4px;font-size:13.5px;white-space:nowrap;cursor:pointer}
.cn2-net{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding:10px 12px;border-radius:12px;background:var(--brand-soft);color:var(--brand-ink);font-size:15px}
.cn2-net b{font-size:19px;direction:ltr}
.cn2-tot h4{margin:6px 0 2px}

/* --- کلید/مقدار (جزئیاتِ گزارشِ روزانه و صورت‌جلسه) --- */
.cn2-kv{width:100%;border-collapse:collapse;font-size:13.5px;margin-bottom:10px}
.cn2-kv th{text-align:right;color:var(--muted);font-weight:600;padding:5px 8px;vertical-align:top;width:140px}
.cn2-kv td{padding:5px 8px;border-bottom:1px solid var(--line);line-height:1.8}

/* --- زیرزبانه‌های کارگاه --- */
.tabs.cn2-subtabs{margin-bottom:12px;flex-wrap:wrap}
.tabs.cn2-subtabs button{font-size:13.5px}

/* --- جعبه‌های امضا --- */
.cn2-sigs{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin:8px 0 14px}
.cn2-sig{border:1px dashed var(--line);border-radius:12px;padding:10px;background:var(--card);text-align:center}
.cn2-sig-t{font-weight:700;margin-bottom:6px}
.cn2-sig-pad{display:block;width:100%;height:140px;border:1px solid var(--line);border-radius:10px;background:#fff;touch-action:none;cursor:crosshair}
.cn2-sig img{max-width:100%;max-height:140px;border:1px solid var(--line);border-radius:10px;background:#fff}
.cn2-sig-done{padding:40px 0}

/* --- انتخابگرِ شخص داخلِ openForm + شخصِ جدید --- */
.cn2-pp{display:flex;gap:6px;align-items:center;flex-wrap:nowrap}
.cn2-pp-w{flex:1;min-width:0}
.cn2-np{margin-top:8px;padding:10px;border:1px solid var(--line);border-radius:10px;background:var(--bg,transparent);display:grid;gap:8px}
.cn2-np input{width:100%}

/* --- گوشی --- */
@media (max-width:640px){
  .cn2-head{grid-template-columns:1fr 1fr}
  .cn2-tot{max-width:none}
  .cn2-sigs{grid-template-columns:1fr}
  .cn-lines input,.cn-lines select{min-width:64px;font-size:14px}
  .cn2-net b{font-size:17px}
}

/* ۴۰٫۲۴: ردیف‌های صورت‌وضعیت روی گوشی/تبلت کارت می‌شوند (table.cardy ِ theme.css با data-l ِ هر خانه)؛
   پیش از این ستونِ «درصدِ تجمعی» بیرون از صفحه می‌ماند و تاریخ زیرِ دکمه‌های تقویم گم می‌شد. */
@media (max-width:900px){
  .cn-lines table.cn2-lines-t.cardy{min-width:0}
  .cn-lines table.cn2-lines-t.cardy td{align-items:center;min-width:0}
  .cn-lines table.cn2-lines-t.cardy td > input{flex:1;min-width:0;width:auto}
  .cn-lines table.cn2-lines-t.cardy td.ln-amt{direction:rtl;text-align:start}
  .cn-lines table.cn2-lines-t.cardy td.cy-act{justify-content:flex-end}
}
@media (max-width:640px){
  .cn2-st .cn2-head{grid-template-columns:minmax(0,1fr)}
  .cn2-st .cn2-head input{min-width:0}
}

/* ۴۰٫۲۲: دکمه‌های ردیفِ پیمانکار چندسطری تا جدول از صفحه بیرون نزند */
.cn2-acts{display:flex;flex-wrap:wrap;gap:4px;min-width:150px;max-width:260px}

/* ۴۰٫۲۵: نیروهای کارگاه و تسویهٔ دستمزد */
.cn2-siteviews{margin-bottom:10px}
.cn2-wks-l{display:grid;gap:2px;max-height:280px;overflow:auto;border:1px solid var(--line);border-radius:10px;padding:4px 10px;margin-bottom:10px}
.cn2-wks-l .cn-check{margin:0;padding:6px 0;border-bottom:1px solid var(--line)}
.cn2-wks-l .cn-check:last-child{border-bottom:0}
.cn2-wks-l .cn-check span{flex:1;min-width:0}
.cn2-wks-l .cn-check b{white-space:nowrap}

/* ۴۰٫۴۳: کارگاه‌ها */
.cn3-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cn3-card { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.cn3-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; }
.cn3-m { font-size: 13.5px; line-height: 1.7; }
#content .cn3-card .badge, #content .cn3-card .hint, #content .cn3-card small, #content .cn3-card .cn-bar, #content .cn3-card .cn-bar * { font-size: 13.5px; }
.cn3-c { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.cn3-checks { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; padding: 4px 0; }
.cn3-ck { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.cn3-ck input { width: auto; }
.cn3-al { width: 100%; }
@media (max-width: 760px) { .cn3-grid { grid-template-columns: 1fr; } }
/* ۴۰٫۵۷: فهرست‌بها و تعدیل */
.cn-est tr.cn-star input[data-k="unit_price"] { border-color: #d97706; }
.cn-est td .badge { margin-inline-start: 4px; }
.cnpl-adj-note { margin: 4px 0 8px; }
.cnpl-it td, .cnpl-it th { white-space: nowrap; }
.cnpl-pt td input[type=checkbox] { width: auto; }

/* ۴۰٫۵۹: خانهٔ مقدار + دکمهٔ برگهٔ متره در ردیفِ صورت‌وضعیت */
.cn6-tot input { min-width: 0; flex: 1 1 auto; }
.cn6-tot .btn { flex: 0 0 auto; }
/* ۴۰٫۶۰ */
.cn7-notes{margin:6px 0 2px}
.cn7-notes .hint{margin:4px 0}
.cn7-art29{margin-top:12px;padding:10px 12px;border:1px solid var(--line,#e5e7eb);border-radius:10px}
.cn7-art29.over{border-color:#dc2626}
.cn7-art29 h4{margin:0 0 6px}
.cn7-warn{color:#b91c1c}
/* ۴۰٫۶۵: کادرِ «رفع شد» ِ بازرسی تمامِ پهنا را می‌گرفت و متن بیرون می‌زد */
.cn-check.cn2-fix{margin:0;min-height:40px}.cn-check.cn2-fix span{white-space:normal;min-width:0}
.cn2-h4{margin:14px 4px 8px}
/* ۴۰٫۶۵: نوشته‌های ریز (۱۰ تا ۱۲ پیکسل) در صفحه‌ها و پنجره‌های پیمانکاری روی گوشی — کمینهٔ ۱۳٫۵ */
@media (max-width:760px){
  body[data-page^="cn"] .tcnt,body[data-page^="cn"] #content .badge,body[data-page^="cn"] #modal .badge,
  body[data-page^="cn"] .cn-head small,body[data-page^="cn"] .cn-head .k,
  body[data-page^="cn"] #modal th,body[data-page^="cn"] #content label,body[data-page^="cn"] #modal td.k{font-size:13.5px}
}
/* ۴۰٫۹۴: خریدِ کارگاه */
.cn10-subs { margin-bottom: 10px; }
.cn10-line { display: grid; grid-template-columns: 2fr 1fr 1fr 1.3fr 1.3fr auto; gap: 8px; align-items: end;
  padding: 8px 0; border-bottom: 1px dashed var(--line, #e5e7eb); }
.cn10-line .ff { margin: 0; }
.cn10-line .cn10-x { margin-bottom: 4px; width: auto; min-width: 40px; justify-self: start; background: transparent;
  color: var(--bad, #dc2626); border: 1px solid currentColor; }
.cn10-cmp td.cn10-best { background: color-mix(in srgb, var(--ok, #16a34a) 14%, transparent); font-weight: 600; }
.cn10-cmp tr.cn10-tot td { border-top: 2px solid var(--line, #e5e7eb); }
.card .val.neg, td.neg { color: var(--bad, #dc2626); }
@media (max-width: 760px) {
  .cn10-line { grid-template-columns: 1fr 1fr; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 10px;
    margin-bottom: 10px; background: var(--card, #fff); }
  .cn10-line .cn10-x { grid-column: 1 / -1; justify-self: end; }
  .cn10-line .cn10-name { grid-column: 1 / -1; }
}
/* ۴۰٫۹۴: تنخواهِ کارگاه */
.cn11-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.cn11-files img { width: 100%; border-radius: 8px; border: 1px solid var(--line, #e5e7eb); }
.cn11-rev .cn11-rj { min-width: 120px; }
/* ۴۰٫۹۸: مستنداتِ کارگاه (construction3.js) */
.cn12-ths { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.cn12-th { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line, #e5e7eb); }
tr.cn12-done td { opacity: .65; }
.cn12-file { position: relative; }
.cn12-file .btn { position: absolute; top: 4px; left: 4px; min-width: 32px; padding: 2px 8px; }
.cn12-fgroup { margin-bottom: 12px; }
.cn12-fgroup h4 { margin: 6px 0; }
.cn12-fgroup > .btn { margin-top: 8px; }
.cn12-map { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.cn12-map img { max-width: 100%; max-height: 70vh; border-radius: 8px; border: 1px solid var(--line, #e5e7eb); user-select: none; }
.cn12-map.pick img { cursor: crosshair; }
.cn12-pin { position: absolute; transform: translate(0, -100%); min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px 12px 12px 2px;
  background: var(--bad, #dc2626); color: #fff; font-size: 13.5px; line-height: 24px; text-align: center; pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.cn12-pin.amber { background: var(--warn, #d97706); }
.cn12-pin.green { background: var(--ok, #16a34a); }
.cn12-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cn12-ph { position: relative; display: flex; flex-direction: column; padding: 0; border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  overflow: hidden; background: var(--card, #fff); color: inherit; cursor: pointer; text-align: start; font: inherit; }
.cn12-ph img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.cn12-ph span { padding: 6px 8px; font-size: 13.5px; }
.cn12-ph .cn12-priv { position: absolute; top: 6px; left: 6px; font-style: normal; background: rgba(0, 0, 0, .55); border-radius: 8px; padding: 0 4px; }
.cn12-big { text-align: center; }
.cn12-big img { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.cn12-holders { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.cn12-warn { border-inline-start: 4px solid var(--warn, #d97706); }
.cn12-old { opacity: .85; }
.cn12-trlist { display: flex; flex-direction: column; gap: 6px; max-height: 45vh; overflow: auto; }
.cn12-trline { display: grid; grid-template-columns: auto 1fr 64px 92px; gap: 8px; align-items: center; padding: 6px 0;
  border-bottom: 1px dashed var(--line, #e5e7eb); }
.cn12-trline input[type="checkbox"] { width: 20px; height: 20px; }
.cn12-q { padding: 10px 12px; border-radius: 10px; background: var(--bg2, rgba(127, 127, 127, .08)); margin-top: 8px; }
.cn12-q.ans { background: color-mix(in srgb, var(--ok, #16a34a) 10%, transparent); }
.cn12-q p { margin: 6px 0 0; white-space: normal; }
@media (max-width: 760px) {
  .cn12-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cn12-trline { grid-template-columns: auto 1fr; }
  .cn12-trline .cn12-tr-n, .cn12-trline .cn12-tr-f { grid-column: 2; }
}
/* ۴۰٫۱۰۰: برنامهٔ زمانی و جریانِ نقد (construction4.js) */
.cn13-track { height: 22px; }
.cn13-track .cn13-bl { top: 2px; height: 5px; background: var(--muted); opacity: .45; }
.cn13-track .cn13-fc { top: 9px; height: 10px; background: color-mix(in srgb, var(--brand) 35%, transparent); overflow: hidden; }
.cn13-fc i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--brand); }
.cn13-fc.crit { background: color-mix(in srgb, var(--bad) 35%, transparent); }
.cn13-fc.crit i { background: var(--bad); }
.cn13-fc.done, .cn13-fc.done i { background: var(--ok); }
.cn13-fc.sum { height: 6px; top: 11px; background: var(--ink, #334155); opacity: .55; }
.cn13-fc.sum i { display: none; }
.cn13-track .cn13-ms { top: 8px; width: 11px !important; height: 11px; border-radius: 2px; transform: translateX(50%) rotate(45deg); background: var(--brand); }
.cn13-ms.crit { background: var(--bad); }
.cn13-ms.done { background: var(--ok); }
.cn13-ce { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .6; }
.cn-g-legend i.cn13-fc, .cn-g-legend i.cn13-bl { display: inline-block; height: 7px; }
.cn-g-legend i.cn13-fc { background: color-mix(in srgb, var(--brand) 55%, transparent); }
.cn-g-legend i.cn13-fc.crit { background: var(--bad); }
.cn-g-legend i.cn13-fc.done { background: var(--ok); }
.cn-g-legend i.cn13-bl { background: var(--muted); opacity: .5; }
.cn-g-legend i.cn13-ce { width: 2px; height: 14px; }
.cn13-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-inline-end: 4px; vertical-align: middle; }
.cn13-critrow td:first-child { border-inline-start: 3px solid var(--bad); }
.cn13-note { border-inline-start: 4px solid var(--warn, #d97706); }
.cn13-note p { margin: 4px 0; }
.cn13-pline, .cn13-phead { display: grid; grid-template-columns: minmax(0, 1fr) 150px 80px auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.cn13-phead { font-size: 14px; color: var(--muted); }
.cn13-net { width: 100%; height: auto; max-height: 260px; display: block; margin-bottom: 8px; }
.cn13-sub { width: 100%; }
@media (max-width: 760px) {
  .cn13-pline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cn13-phead { display: none; }
}
.cn13-ticks { position: relative; height: 20px; }
.cn13-ticks span { position: absolute; top: 0; transform: translateX(50%); font-size: 14px; color: var(--muted); white-space: nowrap; }
.cn13-ticks span::before { content: ""; position: absolute; top: 18px; inset-inline-start: 50%; width: 1px; height: 6px; background: var(--line); }
/* ۴۰٫۱۰۰ (قاعدهٔ کیفیت): قلمِ ≥ ۱۴، هدفِ لمس ≥ ۴۰، خطای کنارِ خانه */
.cn13-gantt { font-size: 14px; }
.cn13-gantt .cn-g-legend, .cn13-gantt + .cn-g-legend { font-size: 14px; }
#cn13-body .btn, .cn13-subs button, .cn13-pline .btn, .cn13-pline select, .cn13-pline input, #cn13-psave, #cn13-dur,
#cn-rep .cn13-cf-tools label { min-height: 40px; }
#cn13-body input[type="checkbox"], #cn-rep input[type="checkbox"] { width: 22px; height: 22px; }
.cn13-bad { border-color: var(--bad) !important; outline: 1px solid var(--bad); }
.cn13-err { color: var(--bad); font-size: 14px; margin: -2px 0 8px; }
