/* =========================
   PGH Step4 — Scoped CSS
   File: assets/css/ss_pgh_step4.css
   ========================= */

.ss-pgh4{
  direction:rtl !important;
  text-align:right !important;
  max-width:1600px !important;
  width:100% !important;
  margin:0 auto !important;
  background:#fff !important;
  padding:0 10px !important;
  --ss-pgh-main-top:0px !important;
  --ss-pgh-main-h:46px !important;
  --ss-pgh4-tabs-top:calc(var(--ss-pgh-main-top) + var(--ss-pgh-main-h)) !important;
  --ss-pgh4-tabs-h:42px !important;
  --ss-pgh4-topbar-top:calc(var(--ss-pgh4-tabs-top) + var(--ss-pgh4-tabs-h)) !important;
}
.ss-pgh4 *{box-sizing:border-box !important}

.ss-pgh4-main-title{
  margin:0 0 10px 0 !important;
  font-size:15px !important;
}
.ss-pgh-wrap > .ss-pgh-tabs{
  position:static !important;
  top:auto !important;
  z-index:auto !important;
  background:#fff !important;
  margin:0 0 8px 0 !important;
  padding:4px 0 !important;
  border-bottom:1px solid #eef0f4 !important;
  box-shadow:none !important;
}

.ss-pgh4-tabs{
  position:static !important;
  top:auto !important;
  z-index:auto !important;
  display:flex !important;
  gap:6px !important;
  flex-wrap:wrap !important;
  margin:0 0 8px 0 !important;
  padding:4px 0 !important;
  background:#fff !important;
  border-bottom:1px solid #eef0f4 !important;
  box-shadow:none !important;
}
body.admin-bar .ss-pgh4{ --ss-pgh-main-top:32px !important; }
@media (max-width:782px){
  body.admin-bar .ss-pgh4{ --ss-pgh-main-top:46px !important; }
}

/* کارت */
.ss-pgh4-card{
  border:1px solid #e7e9ee !important;
  border-radius:14px !important;
  padding:10px !important;
  background:#fff !important;
}

/* نوار بالا */
.ss-pgh4-topbar{
  position:static !important;
  top:auto !important;
  z-index:auto !important;
  background:#fff !important;
  padding:6px 8px !important;
  border:1px solid #eef0f4 !important;
  border-radius:12px !important;
  display:flex !important;
  gap:8px !important;
  align-items:center !important;
  flex-wrap:nowrap !important;
  justify-content:flex-start !important;
  box-shadow:none !important;
}
.ss-pgh4-topbar-inline{
  flex-wrap:nowrap !important;
}
@media (max-width: 1100px){
  .ss-pgh4-topbar{flex-wrap:wrap !important}
  .ss-pgh4-inline-radio{width:100% !important; flex-wrap:wrap !important}
  .ss-pgh4-btn{width:100% !important}
}

.ss-pgh4-topbar label{
  font-size:12px !important;
  color:#374151 !important;
  white-space:nowrap !important;
  display:inline-flex !important;
  align-items:center !important;
  gap:8px !important;
}

.ss-pgh4-inline-item{margin-left:6px !important}

.ss-pgh4-inline-radio{
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  flex-wrap:nowrap !important;
}
.ss-pgh4-radio{
  display:inline-flex !important;
  align-items:center !important;
  gap:8px !important;
  white-space:nowrap !important;
}

.ss-pgh4-spacer{flex:1 1 auto !important}

.ss-pgh4-modehint{
  color:#6b7280 !important;
  font-size:11px !important;
  white-space:nowrap !important;
}

/* دکمه‌ها */
.ss-pgh4-btn{
  border:1px solid #d8dde6 !important;
  background:#f6f8fb !important;
  color:#1f2937 !important;
  border-radius:10px !important;
  padding:6px 10px !important;
  cursor:pointer !important;
  font-size:12px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:34px !important;
  line-height:1 !important;
  white-space:nowrap !important;
  text-decoration:none !important;
}
.ss-pgh4-btn:hover{background:#eef2f7 !important}
.ss-pgh4-btn-primary{background:#eaf2ff !important;border-color:#cfe2ff !important}
.ss-pgh4-btn-primary:hover{background:#ddeaff !important}

.ss-pgh4-msg{margin:10px 0 0 0 !important;font-size:13px !important}
.ss-pgh4-msg.ok{color:#0f5132 !important}
.ss-pgh4-msg.err{color:#842029 !important}

.ss-pgh4-note{margin-top:10px !important;font-size:12px !important;color:#374151 !important}
.ss-pgh4-cap50-notice{
  margin-top:10px !important;
  padding:10px 12px !important;
  border:1px solid #f2c879 !important;
  border-radius:10px !important;
  background:#fff8e8 !important;
  color:#7c4a03 !important;
  font-size:12px !important;
  line-height:1.9 !important;
}
.ss-pgh4-cap50-label.is-disabled{
  color:#9ca3af !important;
  cursor:not-allowed !important;
}
.ss-pgh4-topbar input[type="checkbox"]:disabled{
  border-color:#d1d5db !important;
  background-color:#f3f4f6 !important;
  cursor:not-allowed !important;
  opacity:.75 !important;
}

.ss-pgh4-floatnav{
  position:fixed !important;
  right:max(6px, calc((100vw - min(1600px, 100vw))/2 - 56px)) !important;
  bottom:110px !important;
  z-index:99990 !important;
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
}
.ss-pgh4-floatbtn{
  width:38px !important;
  height:38px !important;
  border-radius:50% !important;
  border:1px solid #d8dde6 !important;
  background:#fff !important;
  color:#111827 !important;
  font-size:16px !important;
  line-height:1 !important;
  cursor:pointer !important;
  box-shadow:0 2px 8px rgba(15,23,42,.15) !important;
}
.ss-pgh4-floatbtn:hover{background:#f3f6fb !important}

/* ---------- ورودی درصد: مثل تکست‌باکس‌ها + وسط چین ---------- */
.ss-pgh4-pctinp{
  width:64px !important;
  height:30px !important;
  padding:4px 8px !important;
  border:1px solid #d7dbe6 !important;
  border-radius:12px !important;
  outline:none !important;
  font-family:inherit !important;
  font-size:13px !important;
  direction:ltr !important;
  text-align:center !important;   /* ✅ وسط چین */
  background:#fff !important;
}
.ss-pgh4-pctinp:focus{
  border-color:#a7c5ff !important;
  box-shadow:0 0 0 3px rgba(80,130,255,.12) !important;
}

/* ---------- رَپ جدول ---------- */
.ss-pgh4-tablewrap{
  margin-top:8px !important;
  border:1px solid #e7e9ee !important;
  border-radius:14px !important;
  overflow:auto !important;
  scroll-margin-top:140px !important;
}

/* ---------- جدول ---------- */
table.ss-pgh4-table{
  width:100% !important;
  border-collapse:collapse !important;
  background:#fff !important;
  table-layout:fixed !important; /* ✅ برای کنترل عرض ستون‌ها */
}

.ss-pgh4-table th,
.ss-pgh4-table td{
  border-bottom:1px solid #eef0f4 !important;
  padding:8px 10px !important;
  vertical-align:middle !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

.ss-pgh4-table thead th{
  background:#111827 !important;   /* مثل ردیف جمع */
  color:#ffffff !important;        /* متن سفید */
  font-weight:700 !important;
  text-align:center !important;
  font-size:13px !important;
  border-bottom:0 !important;
}


.ss-pgh4-table td{
  text-align:center !important;
  font-size:12px !important;
}

/* ---------- ✅ استایل چک‌باکس مثل تکست‌باکس‌ها ---------- */
.ss-pgh4-table input[type="checkbox"],
.ss-pgh4-topbar input[type="checkbox"]{
  -webkit-appearance:none !important;
  appearance:none !important;
  width:18px !important;
  height:18px !important;
  border:1px solid #d7dbe6 !important;  /* ✅ خط نازک */
  border-radius:8px !important;         /* ✅ گوشه گرد */
  background:#fff !important;
  display:inline-grid !important;
  place-content:center !important;
  cursor:pointer !important;
}
.ss-pgh4-table input[type="checkbox"]:focus,
.ss-pgh4-topbar input[type="checkbox"]:focus{
  outline:none !important;
  border-color:#a7c5ff !important;
  box-shadow:0 0 0 3px rgba(80,130,255,.12) !important;
}
.ss-pgh4-table input[type="checkbox"]:checked,
.ss-pgh4-topbar input[type="checkbox"]:checked{
  border-color:#86efac !important;
  background-color:#dcfce7 !important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%230f5132' d='M7.6 13.9 3.7 10l1.4-1.4 2.5 2.5 7.3-7.3L16.3 5z'/%3E%3C/svg%3E") !important;
  background-repeat:no-repeat !important;
  background-position:center !important;
}

/* ---------- رادیوها (همان ظاهر پیشفرض، فقط فاصله) ---------- */
.ss-pgh4-topbar input[type="radio"]{
  margin:0 !important;
}

/* ---------- کنترل عرض ستون‌ها ---------- */
.ss-pgh4-col-check{width:62px !important}
.ss-pgh4-col-rownum{width:44px !important}
.ss-pgh4-col-list{width:140px !important}
.ss-pgh4-col-fasl{width:60px !important}
.ss-pgh4-col-faslsh{width:190px !important}
.ss-pgh4-col-item{width:120px !important}
.ss-pgh4-col-total{width:160px !important}
/* ستون شرح ردیف خودش باقیمانده را می‌گیرد */

/* ---------- سلول‌های wrap ---------- */
.ss-pgh4-td-wrap-sm{
  font-size:11px !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:break-word !important;
  text-align:right !important;
  line-height:1.2 !important;
}
.ss-pgh4-td-wrap-big{
  font-size:13px !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:break-word !important;
  text-align:right !important;
  line-height:1.35 !important;
}

.ss-pgh4-td-item,
.ss-pgh4-td-total{
  direction:ltr !important;
  font-variant-numeric:tabular-nums !important;
}

/* ---------- ردیف‌های تیک‌خورده: سبز کمرنگ ---------- */
table.ss-pgh4-table tbody tr.ss-pgh4-row-checked td{
  background:#e7f8ee !important;
}

/* ---------- فوتر جمع: مشکی با متن سفید ---------- */
table.ss-pgh4-table tfoot tr.ss-pgh4-sumrow th,
table.ss-pgh4-table tfoot tr.ss-pgh4-sumrow td{
  background:#111827 !important;
  color:#ffffff !important;
  border-top:1px solid #111827 !important;
  border-bottom:0 !important;
}
table.ss-pgh4-table tfoot tr.ss-pgh4-sumrow .ss-pgh4-sumlabel{
  text-align:left !important;
  font-size:12px !important;
}
table.ss-pgh4-table tfoot tr.ss-pgh4-sumrow .ss-pgh4-sumval{
  text-align:center !important;
  direction:ltr !important;
  font-variant-numeric:tabular-nums !important;
  font-size:12px !important;
}
.ss-pgh4-title{display:none !important}

/* =========================
   Step4 - Table 2 additions
   ========================= */

.ss-pgh4-subblock{margin-top:14px !important}
.ss-pgh4-subtitle{
  margin:0 0 8px 0 !important;
  font-size:14px !important;
  font-weight:700 !important;
  color:#111827 !important;
  text-align:center !important;
}

/* جدول 2 - عرض ستون‌ها */
.ss-pgh4-t2-col-no{width:60px !important}
.ss-pgh4-t2-col-fasl{width:60px !important}
.ss-pgh4-t2-col-faslsh{width:180px !important}
.ss-pgh4-t2-col-item{width:120px !important}
.ss-pgh4-t2-col-unit{width:90px !important}
.ss-pgh4-t2-col-up{width:130px !important}
.ss-pgh4-t2-col-qty{width:110px !important}
.ss-pgh4-t2-col-total{width:140px !important}
.ss-pgh4-t2-col-pct{width:160px !important}
/* ستون شرح کامل ردیف (باقیمانده) */

.ss-pgh4-td-num{
  direction:ltr !important;
  unicode-bidi:isolate !important;
  font-variant-numeric:tabular-nums !important;
  text-align:center !important;
  white-space:nowrap !important;
}
.ss-pgh4-star-mark{
  display:inline-block;
  margin-left:4px;
  color:#f59e0b;
  font-weight:700;
}
/* =========================
   Step4 - Table 2 overrides
   ========================= */

/* تیتر جدول ۲ روشن باشد (برخلاف جدول ۱) */
table.ss-pgh4-t2-table thead th{
  background:#eef2f7 !important;
  color:#111827 !important;
  font-weight:700 !important;
  text-align:center !important;
}

/* فقط ردیف جمع مشکی بماند */
table.ss-pgh4-t2-table tfoot tr.ss-pgh4-sumrow th,
table.ss-pgh4-t2-table tfoot tr.ss-pgh4-sumrow td{
  background:#111827 !important;
  color:#fff !important;
}
table.ss-pgh4-t2-table{
  table-layout:auto !important;
  width:100% !important;
}
table.ss-pgh4-t2-table th,
table.ss-pgh4-t2-table td{
  overflow:visible !important;
  text-overflow:clip !important;
  white-space:nowrap !important;
}
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-no,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-fasl,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-faslsh,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-item,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-unit,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-up,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-qty,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-total,
table.ss-pgh4-t2-table th.ss-pgh4-t2-col-pct,
table.ss-pgh4-t2-table td.ss-pgh4-td-num{
  width:auto !important;
}
/* عرض ستون‌های جدول ۲ */
.ss-pgh4-t2-col-no{min-width:52px !important}
.ss-pgh4-t2-col-fasl{min-width:52px !important}
.ss-pgh4-t2-col-item{min-width:105px !important}
.ss-pgh4-t2-col-unit{min-width:70px !important}
.ss-pgh4-t2-col-qty{min-width:85px !important}
.ss-pgh4-t2-col-pct{min-width:95px !important}

/* بهای واحد و بهای کل متوسط */
.ss-pgh4-t2-col-up{min-width:125px !important}
.ss-pgh4-t2-col-total{min-width:135px !important}

/* شرح فصل کوچک و wrap */
.ss-pgh4-t2-col-faslsh{min-width:160px !important}

/* شرح کامل ردیف بزرگتر + wrap */
.ss-pgh4-t2-col-desc{width:auto !important;min-width:260px !important}
table.ss-pgh4-t2-table td.ss-pgh4-td-wrap-big{
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:break-word !important;
  text-align:right !important;
  font-size:13px !important;   /* بزرگ‌تر از بقیه */
  line-height:1.35 !important;
}

/* سایر ستون‌های متنی کوچک‌تر و wrap */
table.ss-pgh4-t2-table td.ss-pgh4-td-wrap-sm{
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:break-word !important;
  font-size:11px !important;
  line-height:1.25 !important;
}

/* تیتر ستون درصد کوچک‌تر */
table.ss-pgh4-t2-table thead th.ss-pgh4-t2-col-pct-head{
  font-size:10.5px !important;
  line-height:1.15 !important;
}
.ss-pgh4-grand-center{
  text-align:center !important;
}
.ss-pgh4-subtitle{
  margin:0 0 8px 0 !important;
  font-size:14px !important;
  font-weight:800 !important;
  color:#111827 !important;
  text-align:center !important;
}
.ss-pgh4-tablewrap-thick{
  border:2px solid #111827 !important;
  border-radius:14px !important;
  overflow:auto !important;
}

/* =========================
   Step4 - Table 3 compact
   ========================= */
table.ss-pgh4-t3-table{
  table-layout:auto !important;
}
table.ss-pgh4-t3-table th,
table.ss-pgh4-t3-table td{
  padding:6px 8px !important;
  line-height:1.3 !important;
}
table.ss-pgh4-t3-table td{
  font-size:12px !important;
  height:auto !important;
}
table.ss-pgh4-t3-table td.ss-pgh4-td-num{
  white-space:nowrap !important;
}
table.ss-pgh4-t3-table td.ss-pgh4-t3-fasl-title{
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:break-word !important;
  text-align:right !important;
  font-size:12px !important;
}
