:root{
  --navy:#1c2649; --red:#cf111b; --gold:#c9a250;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:"Tajawal","Cairo","Segoe UI",sans-serif;background:#eef2f8;color:#0f172a}
body{display:flex;min-height:100vh}

.lt-panel{
  width:380px;flex-shrink:0;background:#fff;border-left:1px solid #e2e8f0;
  padding:20px 18px;overflow:auto;height:100vh;position:sticky;top:0;
  box-shadow:0 0 18px rgba(0,0,0,.05)
}
.lt-brand{display:flex;gap:12px;align-items:center;margin-bottom:14px}
.lt-brand img{width:48px;height:48px;border-radius:50%;border:2px solid var(--gold);object-fit:cover;background:#fff}
.lt-brand h1{margin:0;font-size:18px;color:var(--navy);font-weight:900}
.lt-brand p{margin:2px 0 0;font-size:12px;color:var(--red);font-weight:700}

.lt-actions{display:grid;gap:8px;grid-template-columns:1fr 1fr;margin-bottom:14px}
.lt-actions .lt-back{grid-column:1/-1}
.lt-actions button,.lt-actions a{
  padding:11px 12px;border-radius:10px;border:0;cursor:pointer;
  font-weight:800;font-size:13.5px;text-align:center;text-decoration:none;
  transition:transform .12s,box-shadow .12s
}
.lt-back{background:linear-gradient(180deg,var(--gold),#9c7a30);color:var(--navy)!important}
.lt-primary{background:linear-gradient(180deg,#d80007,#9a0006);color:#fff;box-shadow:0 6px 14px rgba(207,17,27,.3)}
.lt-ghost{background:#f1f5f9;color:var(--navy);border:1px solid #cbd5e1!important}
.lt-actions button:hover,.lt-actions a:hover{transform:translateY(-1px)}

.lt-fields{display:grid;gap:10px;margin-bottom:14px}
.lt-fields label{display:grid;gap:4px;font-size:12px;font-weight:700;color:#475569}
.lt-fields input,.lt-fields textarea,.lt-fields select{
  padding:9px 10px;border-radius:9px;border:1px solid #cbd5e1;background:#f8fafc;
  font:inherit;color:#0f172a
}
.lt-fields input:focus,.lt-fields textarea:focus,.lt-fields select:focus{
  outline:none;border-color:var(--red);box-shadow:0 0 0 3px rgba(207,17,27,.12);background:#fff
}
.lt-fields input[readonly]{background:#eef2f8;color:var(--navy);font-weight:800;cursor:not-allowed}
.lt-fields textarea{resize:none;min-height:140px;max-width:100%;box-sizing:border-box;line-height:1.85;overflow:hidden;word-wrap:break-word;overflow-wrap:break-word;white-space:pre-wrap;display:block}
.lt-hint{font-size:11.5px;color:#64748b;margin:6px 0 0;line-height:1.6;background:#fef3c7;padding:8px 10px;border-radius:8px;border:1px solid #fde68a}

/* محرّر النص المنسّق لنص الخطاب */
.lt-rte{border:1px solid #cbd5e1;border-radius:10px;overflow:hidden;background:#fff;box-sizing:border-box}
.lt-rte-bar{display:flex;flex-wrap:wrap;align-items:center;gap:3px;padding:6px;background:#f4f6fa;border-bottom:1px solid #e2e8f0}
.lt-rte-bar button{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;padding:0 6px;font-size:13px;line-height:1;border:1px solid #d4dbe6;background:#fff;color:#1f2937;border-radius:6px;cursor:pointer}
.lt-rte-bar button:hover{background:#eef2f8;border-color:#b9c4d4}
.lt-rte-bar button:active{background:#e2e8f0}
.lt-rte-bar select{height:28px;border:1px solid #d4dbe6;border-radius:6px;background:#fff;color:#1f2937;font-size:12px;padding:0 4px;cursor:pointer;font-family:inherit}
.lt-rte-sep{width:1px;align-self:stretch;background:#d4dbe6;margin:2px 3px}
.lt-rte-colors{display:inline-flex;gap:3px;align-items:center}
.lt-rte-swatch{width:20px;height:20px;min-width:20px;padding:0;border:1px solid rgba(0,0,0,.18);border-radius:5px;cursor:pointer}
.lt-rte-swatch.lt-rte-hi{display:inline-flex;align-items:center;justify-content:center;font-size:12px;color:#64748b}
.lt-rte-area{min-height:260px;max-height:440px;overflow:auto;padding:12px 14px;line-height:1.9;text-align:justify;outline:none;font-size:15px;color:#1f2937;font-family:inherit}
.lt-rte-area:focus{background:#fff}
.lt-rte-area p{margin:0 0 .6em}

.lt-colors{display:grid;gap:8px;grid-template-columns:1fr 1fr;margin-bottom:14px;background:#f8fafc;padding:10px;border-radius:10px;border:1px solid #e2e8f0}
.lt-colors label{font-size:12px;font-weight:700;color:#475569;display:flex;justify-content:space-between;align-items:center;gap:6px}
.lt-colors input[type=color]{width:42px;height:30px;padding:0;border:1px solid #cbd5e1;border-radius:6px;background:#fff;cursor:pointer}
.lt-colors select{padding:5px 8px;border-radius:7px;border:1px solid #cbd5e1;background:#fff;font:inherit}

.lt-preview{flex:1;padding:30px 20px;display:flex;flex-direction:column;align-items:center;overflow:auto}
#ltPageStack{display:flex;flex-direction:column;align-items:center;gap:24px;width:210mm}

/* A4 letter page — fixed 210×297mm */
.letter-page{
  width:210mm;height:297mm;background:#fff;position:relative;
  background-image:url('assets/letter-bg.png');
  background-size:210mm 297mm;background-position:0 0;background-repeat:no-repeat;
  padding:2mm 18mm 22mm;
  box-shadow:0 14px 40px rgba(0,0,0,.15);
  font-size:14px;line-height:1.7;color:#1f2937;
  display:flex;flex-direction:column;gap:1.5mm;overflow:hidden
}

.lh{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:0 0 3mm;padding-bottom:3mm;border-bottom:1.5px solid rgba(201,162,80,.5)}
.lh-logo-block{text-align:center;color:var(--navy);font-weight:900;display:flex;flex-direction:column;align-items:center;gap:0}
.lh-logo{width:30mm;height:auto;max-height:20mm;object-fit:contain;display:block;margin:0}
.lh-name-ar{font-size:14px;color:var(--navy);font-weight:900;line-height:1.2;margin-top:1mm}
.lh-name-en{font-size:9.5px;color:#475569;direction:ltr;letter-spacing:1px;line-height:1.2}
.lh-meta-stack{display:flex;flex-direction:column;gap:2mm;font-size:13px;min-width:55mm}
.lh-meta-row{display:flex;align-items:center;gap:8px;background:rgba(255,255,255,.6);padding:1.6mm 3mm;border-radius:6px;border:1px solid rgba(201,162,80,.35)}
.lh-meta-row > span{color:#64748b;font-weight:700;flex:0 0 14mm}
.lh-meta-row > b{color:var(--navy);font-weight:800}
.lh-meta{display:flex;gap:14px;font-size:13.5px;align-items:center;flex-shrink:0}
.lh-row{display:inline-flex;gap:6px;color:var(--navy);align-items:center}
.lh-row span{color:#64748b;font-weight:700}
.lh-row b{color:var(--navy);font-weight:800}
.lh-band{
  margin:2mm auto 4mm;width:88%;padding:5mm 6mm;border-radius:14px;
  background:linear-gradient(160deg,#1f2a52 0%,#131c3d 100%);
  color:#fff;text-align:center;font-size:22px;font-weight:900;letter-spacing:1px;
  box-shadow:0 8px 20px rgba(15,23,42,.22);border-top:2px solid var(--gold);
  position:relative
}
.lh-band::after{content:"";display:block;width:36mm;height:2px;margin:3mm auto 0;background:linear-gradient(90deg,transparent,var(--gold),transparent)}

.lb-to{font-size:15px;font-weight:800;color:var(--navy);display:flex;justify-content:space-between;align-items:center;gap:14px;margin:1mm 0 0}
.lb-to .lb-to-main{flex:1}
.lb-to .lb-to-main > span{color:#475569;font-weight:700;margin-left:6px}
.lb-to .lb-to-main > b{white-space:pre-wrap}
#vTo{padding-inline-end:18mm}

.lb-subject{
  text-align:center;font-size:16px;font-weight:900;color:var(--red);
  margin:0;padding:2mm 6mm;border:1.6px solid var(--red);border-radius:10px;
  background:rgba(255,255,255,.7)
}

.lb-greet{font-weight:800;color:var(--navy);margin:3mm 0 1mm}

.lb-body{
  flex:1;text-align:justify;white-space:pre-wrap;line-height:1.9;
  background:rgba(255,255,255,.55);padding:4mm 5mm;border-radius:10px;
  overflow:hidden;min-height:0
}
.lb-body[contenteditable=true]:focus{outline:2px dashed var(--gold);outline-offset:2px;background:rgba(255,255,255,.8)}

.lb-sign{margin-top:3mm;display:flex;justify-content:flex-end}
.lb-sign-block{
  width:75mm;text-align:center;background:rgba(255,255,255,.7);
  border:1.5px solid var(--gold);border-radius:12px;padding:5mm 4mm
}
.lb-sign-role{font-weight:800;color:var(--red);font-size:14px}
.lb-sign-name{font-weight:900;color:var(--navy);margin-top:2mm;font-size:15px}
.lb-sign-line{margin-top:7mm;padding-top:3mm;border-top:1.5px dashed #94a3b8;color:#64748b;font-size:12px;font-weight:700}

[contenteditable=true]:focus{outline:2px dashed var(--gold);outline-offset:2px}

@media (max-width: 1100px){
  body{flex-direction:column}
  .lt-panel{width:100%;height:auto;position:static}
}
@media (max-width: 640px){
  .lt-preview{padding:10px 4px;overflow-x:hidden}
  .letter-page{
    transform:scale(var(--mob-page-scale, 0.46));
    transform-origin:top center;
    margin-bottom:calc(-297mm * (1 - var(--mob-page-scale, 0.46)));
  }
}

@media print{
  body{background:#fff;display:block}
  .lt-panel{display:none!important}
  .lt-preview{padding:0;display:block}
  .letter-page{box-shadow:none;margin:0;width:210mm;height:297mm;page-break-after:avoid}
  @page{size:A4 portrait;margin:0}
}

/* ===== مكتبة الخطابات ===== */
.lt-library{margin-bottom:14px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:12px}
.lt-lib-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}
.lt-lib-head h2{margin:0;font-size:14px;font-weight:900;color:var(--navy)}
.lt-status{font-size:11px;font-weight:800;padding:3px 9px;border-radius:20px;white-space:nowrap}
.lt-status-draft{background:#fef3c7;color:#92400e;border:1px solid #fde68a}
.lt-status-saved{background:#dcfce7;color:#166534;border:1px solid #bbf7d0}
.lt-status-flash{background:#dbeafe;color:#1e40af;border:1px solid #bfdbfe}
.lt-lib-btns{display:grid;grid-template-columns:1fr auto;gap:8px;margin-bottom:10px}
.lt-lib-btns button{padding:10px 12px;border-radius:10px;border:0;cursor:pointer;font-weight:800;font-size:13px;transition:transform .12s}
.lt-lib-btns button:hover{transform:translateY(-1px)}
.lt-lib-btns .lt-ghost{border:1px solid #cbd5e1!important}
.lt-lib-list{display:grid;gap:8px;max-height:300px;overflow:auto}
.lt-lib-empty{font-size:12px;color:#64748b;text-align:center;margin:8px 0;line-height:1.6}
.lt-lib-item{display:flex;align-items:stretch;gap:0;background:#fff;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden;transition:border-color .12s,box-shadow .12s}
.lt-lib-item:hover{border-color:var(--gold)}
.lt-lib-active{border-color:var(--red);box-shadow:0 0 0 2px rgba(207,17,27,.12)}
.lt-lib-open{flex:1;min-width:0;display:grid;gap:3px;text-align:right;background:transparent;border:0;cursor:pointer;padding:9px 10px;font:inherit}
.lt-lib-name{font-weight:800;color:var(--navy);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lt-lib-meta{display:flex;align-items:center;gap:6px;font-size:11px;color:#64748b}
.lt-lib-badge{background:var(--navy);color:#fff;padding:1px 7px;border-radius:20px;font-size:10px;font-weight:800}
.lt-lib-tools{display:flex;flex-direction:column;flex-shrink:0}
.lt-lib-tools button{flex:1;background:#f1f5f9;border:0;border-inline-start:1px solid #e2e8f0;cursor:pointer;padding:0 11px;font-size:13px;color:#475569}
.lt-lib-tools button:hover{background:#e2e8f0}
.lt-lib-del:hover{background:#fee2e2!important}

/* ===== خلفية صفحة الخطاب ===== */
.lt-bgbox{margin-bottom:14px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:12px}
.lt-bgbox h2{margin:0 0 10px;font-size:14px;font-weight:900;color:var(--navy)}
.lt-bg-actions{display:grid;grid-template-columns:1fr auto;gap:8px;margin-bottom:10px}
.lt-bg-up{display:flex;align-items:center;justify-content:center;gap:6px;padding:10px 12px;border-radius:10px;cursor:pointer;font-weight:800;font-size:13px;background:linear-gradient(180deg,var(--gold),#9c7a30);color:var(--navy);text-align:center}
.lt-bg-up input{display:none}
.lt-bg-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.lt-bg-item,.lt-bg-pick{width:100%;height:54px;border-radius:9px;border:1px solid #cbd5e1;cursor:pointer;background:#fff;background-size:cover;background-position:center;font-weight:800;font-size:12px;color:var(--navy)}
.lt-bg-default{display:flex;align-items:center;justify-content:center}
.lt-bg-cell{position:relative}
.lt-bg-active{border-color:var(--red)!important;box-shadow:0 0 0 2px rgba(207,17,27,.18)}
.lt-bg-cell.lt-bg-active .lt-bg-pick{border-color:var(--red)}
.lt-bg-del{position:absolute;top:3px;left:3px;width:22px;height:22px;border:0;border-radius:6px;background:rgba(255,255,255,.92);cursor:pointer;font-size:12px;line-height:1;box-shadow:0 1px 4px rgba(0,0,0,.2)}
.lt-bg-del:hover{background:#fee2e2}

/* ===== خطاب عام: عنوان وسطر الموقع ===== */
.lb-title{
  text-align:center;font-size:20px;font-weight:900;color:var(--navy);
  margin:0 auto 2mm;padding:3mm 6mm;border:2px solid var(--navy);border-radius:12px;
  background:rgba(255,255,255,.7);width:88%
}
.lb-loc{margin:2mm 0 0;font-weight:800;color:var(--navy);font-size:14px}
.lb-loc .lb-loc-title{color:#475569;font-weight:700}

/* ===== الختم والتوقيع على الخطاب ===== */
.lb-seal{display:flex;align-items:flex-end;justify-content:center;gap:6mm;margin-top:4mm;min-height:18mm;flex-wrap:nowrap}
.lb-seal-sig{max-height:18mm;max-width:38mm;min-width:0;flex:0 1 auto;object-fit:contain}
.lb-seal-stamp{max-height:22mm;max-width:30mm;min-width:0;flex:0 1 auto;object-fit:contain;mix-blend-mode:multiply}

/* ===== صندوق الختم والإرسال في الشريط الجانبي ===== */
.lt-sealbox,.lt-sendbox{margin-bottom:14px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:12px}
.lt-sealbox h2,.lt-sendbox h2{margin:0 0 10px;font-size:14px;font-weight:900;color:var(--navy)}
.lt-check{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:700;color:#334155;margin-bottom:8px;cursor:pointer}
.lt-check input{width:16px;height:16px;accent-color:var(--red);cursor:pointer}
.lt-check input:disabled{cursor:not-allowed}
.lt-seal-hint{margin:6px 0 0;font-size:11px;color:#64748b;line-height:1.6}
.lt-actions a.lt-ghost,.lt-actions a.lt-back{text-decoration:none;display:inline-flex;align-items:center;justify-content:center}

/* ===== النوافذ المنبثقة ===== */
.lt-modal{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:18px}
.lt-modal[hidden]{display:none}
.lt-modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.55);backdrop-filter:blur(2px)}
.lt-modal-card{position:relative;background:#fff;border-radius:16px;box-shadow:0 24px 60px rgba(0,0,0,.35);width:100%;max-width:480px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}
.lt-modal-wide{max-width:680px}
.lt-modal-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 18px;border-bottom:1px solid #e2e8f0}
.lt-modal-head h3{margin:0;font-size:16px;font-weight:900;color:var(--navy)}
.lt-modal-x{background:#f1f5f9;border:0;width:32px;height:32px;border-radius:9px;cursor:pointer;font-size:15px;color:#475569}
.lt-modal-x:hover{background:#fee2e2}
.lt-modal-body{padding:16px 18px;overflow:auto}
.lt-modal-foot{display:flex;align-items:center;gap:8px;padding:12px 18px;border-top:1px solid #e2e8f0;background:#f8fafc}
.lt-foot-spacer{flex:1}
.lt-modal-foot button{padding:9px 14px;border-radius:10px;border:0;cursor:pointer;font-weight:800;font-size:13px}
.lt-modal-foot .lt-ghost{border:1px solid #cbd5e1!important}
.lt-sep{border:0;border-top:1px solid #e2e8f0;margin:16px 0}
.lt-modal-body h4{margin:0 0 8px;font-size:14px;font-weight:900;color:var(--navy)}
.lt-smtp-note{margin:0 0 12px;font-size:12px;color:#64748b;line-height:1.6}
.lt-smtp-help{margin:0 0 14px;border:1px solid #dbe3ef;border-radius:10px;background:#f8fafc;overflow:hidden}
.lt-smtp-help summary{cursor:pointer;list-style:none;padding:10px 12px;font-size:13px;font-weight:800;color:var(--navy);user-select:none}
.lt-smtp-help summary::-webkit-details-marker{display:none}
.lt-smtp-help summary::after{content:"▾";float:left;color:#94a3b8;transition:transform .2s}
.lt-smtp-help[open] summary::after{transform:rotate(180deg)}
.lt-smtp-help[open] summary{border-bottom:1px solid #e2e8f0}
.lt-smtp-help-body{padding:10px 14px 12px;font-size:12px;color:#475569;line-height:1.8}
.lt-smtp-help-body p{margin:0 0 8px}
.lt-smtp-help-body ol{margin:0;padding-inline-start:20px}
.lt-smtp-help-body ol>li{margin-bottom:6px}
.lt-smtp-help-body ul{margin:5px 0;padding-inline-start:18px;list-style:disc}
.lt-smtp-help-body a{color:var(--red);word-break:break-all}
.lt-smtp-help-body code{background:#eef2f7;border:1px solid #e2e8f0;border-radius:5px;padding:1px 5px;font-size:11px;color:var(--navy)}
.lt-smtp-warn{margin:10px 0 0;padding:8px 10px;background:#fff7ed;border:1px solid #fed7aa;border-radius:8px;color:#9a3412;font-weight:700}
.lt-seal-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.lt-asset h4{margin:0 0 8px}
.lt-asset-preview{height:96px;border:1px dashed #cbd5e1;border-radius:10px;background:#f8fafc;display:flex;align-items:center;justify-content:center;overflow:hidden;margin-bottom:8px}
.lt-asset-preview img{max-height:88px;max-width:100%;object-fit:contain}
.lt-asset-empty{font-size:12px;color:#94a3b8;font-weight:700}
.lt-asset-btns{display:grid;grid-template-columns:1fr auto;gap:8px;margin-bottom:6px}
.lt-asset-up{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 10px;border-radius:9px;cursor:pointer;font-weight:800;font-size:12px;background:linear-gradient(180deg,var(--gold),#9c7a30);color:var(--navy)}
.lt-asset-up input{display:none}
.lt-asset-btns .lt-ghost{padding:8px 10px;border-radius:9px;cursor:pointer;font-weight:800;font-size:12px;border:1px solid #cbd5e1!important;background:#f1f5f9;color:var(--navy)}
.lt-asset small{font-size:11px;color:#94a3b8}
.lt-smtp-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.lt-smtp-grid label,.lt-fld{display:grid;gap:4px;font-size:12px;font-weight:700;color:#475569}
.lt-fld{margin-bottom:12px}
.lt-smtp-grid input,.lt-smtp-grid select,.lt-fld input,.lt-fld textarea{
  padding:9px 11px;border:1px solid #cbd5e1;border-radius:9px;font:inherit;font-size:13px;background:#fff;width:100%;box-sizing:border-box
}
.lt-fld textarea{resize:vertical;line-height:1.8}
.lt-modal-msg{margin-top:12px;padding:9px 12px;border-radius:9px;font-size:12px;font-weight:700;line-height:1.6}
.lt-modal-msg[hidden]{display:none}
.lt-msg-ok{background:#dcfce7;color:#166534;border:1px solid #bbf7d0}
.lt-msg-err{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
@media (max-width:560px){.lt-seal-grid,.lt-smtp-grid{grid-template-columns:1fr}}

/* =====================================================================
   محضر المزايدة — لوحة التحرير (اليسار)
   ===================================================================== */
.mn-fields{border-top:1px solid #e2e8f0;padding-top:12px;margin-top:4px}
.mn-fields:first-child{border-top:none}
.mn-sec-head{display:block;font-size:12px;font-weight:900;color:var(--navy);text-transform:uppercase;letter-spacing:.04em;margin-bottom:10px;padding-bottom:6px;border-bottom:2px solid #e2e8f0}
/* صفوف الجداول في لوحة التحرير */
.mn-rows-editor{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}
.mn-row{display:grid;grid-template-columns:20px 1fr 1fr auto;gap:5px;align-items:center}
.mn-row-num{font-size:11px;color:#94a3b8;font-weight:800;text-align:center}
.mn-row input{padding:6px 8px;border:1px solid #cbd5e1;border-radius:7px;font:inherit;font-size:12px;width:100%;box-sizing:border-box;background:#fff}
.mn-row input:focus{border-color:var(--navy);outline:none}
.mn-del-row{background:none;border:none;cursor:pointer;color:#ef4444;font-size:13px;padding:3px 5px;border-radius:5px;line-height:1}
.mn-del-row:hover{background:#fee2e2}
.mn-no-rows{font-size:11px;color:#94a3b8;text-align:center;padding:8px 0;margin:0}
.mn-add-row,.mn-add-bid-row{width:100%;margin-top:4px}
/* بيانات العطاء */
.mn-bid-editor{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:10px;margin-bottom:10px}
.mn-bid-head{display:flex;gap:6px;align-items:center;margin-bottom:8px}
.mn-bid-title-input{flex:1;padding:7px 10px;border:1px solid #cbd5e1;border-radius:8px;font:inherit;font-size:13px;font-weight:700;background:#fff}
.mn-bid-title-input:focus{border-color:var(--navy);outline:none}
.mn-del-bid{background:none;border:none;cursor:pointer;font-size:16px;padding:4px;border-radius:6px;line-height:1}
.mn-del-bid:hover{background:#fee2e2}
.mn-auction-title-lbl{display:grid;gap:4px;font-size:12px;font-weight:700;color:#475569;margin-bottom:8px}
.mn-auction-title-lbl input{padding:6px 9px;border:1px solid #cbd5e1;border-radius:7px;font:inherit;font-size:12px;background:#fff;width:100%;box-sizing:border-box}
.mn-bid-rows-wrap{display:flex;flex-direction:column;gap:6px}
.mn-bid-rows-box{display:flex;flex-direction:column;gap:5px}
.mn-bid-row{display:grid;grid-template-columns:20px 1fr 80px 60px 80px auto;gap:4px;align-items:center}
.mn-bid-row input{padding:5px 7px;border:1px solid #cbd5e1;border-radius:6px;font:inherit;font-size:11px;width:100%;box-sizing:border-box;background:#fff}
.mn-bid-row input:focus{border-color:var(--navy);outline:none}
.mn-del-bid-row{background:none;border:none;cursor:pointer;color:#ef4444;font-size:12px;padding:3px 5px;border-radius:5px;line-height:1}
.mn-del-bid-row:hover{background:#fee2e2}
/* صفحات فارغة */
.mn-blank-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.mn-blank-count{font-size:12px;font-weight:700;color:var(--navy)}

/* =====================================================================
   محضر المزايدة — معاينة الطباعة (يمين)
   ===================================================================== */
#minutesPreview{display:flex;flex-direction:column;gap:40px;padding:40px 20px;background:#cbd5e1;min-height:100%}
#minutesPreview .mn-page{margin:0 auto}

/* محتوى صفحة المحضر */
.mn-body{padding:28px 40px 32px;display:flex;flex-direction:column;gap:10px;flex:1}
.mn-body-blank{min-height:400px}

/* العنوان الرئيسي */
.mn-main-title{font-size:1.25em;font-weight:900;text-align:center;border-bottom:3px double;padding-bottom:10px;margin:0 0 8px;line-height:1.4}
.mn-subject-inline{font-size:.85em;font-weight:700}
.mn-sec-title{font-size:1.1em;font-weight:900;border-bottom:2px solid;padding-bottom:8px;margin:0 0 8px;line-height:1.4}

/* النصوص الدينية */
.mn-basmala{text-align:center;font-weight:700;font-size:1.05em;margin:4px 0}
.mn-hamd{text-align:center;line-height:1.9;font-size:.95em;color:#374151;margin:4px 0}

/* نصوص المحضر */
.mn-opening{line-height:2;margin:6px 0;font-size:.97em}
.mn-location{line-height:2;margin:6px 0;font-size:.97em}
.mn-val{font-weight:800;text-decoration:underline;text-underline-offset:3px}
.mn-party-label{font-weight:900;font-size:1em;margin:10px 0 4px;line-height:1.7}
.mn-intro-text{background:#f8fafc;border-right:3px solid #e2e8f0;padding:8px 12px;border-radius:6px;font-size:.92em;line-height:1.9;color:#374151}
.mn-closing-text{font-size:.93em;line-height:1.9;color:#374151;margin:8px 0;font-style:italic}

/* جداول الحضور والعطاء */
.mn-table{width:100%;border-collapse:collapse;margin:6px 0;font-size:.9em;direction:rtl}
.mn-table thead tr{background:var(--navy,#1d3a8a);color:#fff}
.mn-table th{padding:8px 12px;font-weight:800;font-size:.88em;text-align:right;white-space:nowrap}
.mn-table td{padding:7px 12px;border-bottom:1px solid #e2e8f0;text-align:right;vertical-align:middle}
.mn-table tbody tr:nth-child(even){background:#f8fafc}
.mn-table tbody tr:hover{background:#eff6ff}
.mn-td-num{width:40px;text-align:center!important;color:#94a3b8;font-weight:700;font-size:.85em}
.mn-empty-row td,.mn-empty-row{text-align:center;color:#94a3b8;font-size:.85em;padding:12px}
.mn-bid-table th:nth-child(2){min-width:140px}
.mn-bid-table th:nth-child(3){min-width:110px}

/* بيانات العطاء */
.mn-bid-subject{font-size:.96em;line-height:1.9;margin:2px 0 8px}

/* توصية اللجنة */
.mn-rec-intro{font-weight:700;font-size:1em;margin:8px 0 4px}
.mn-rec-line{font-size:1em;line-height:2.1;background:#f0f9ff;border:1px solid #bae6fd;border-radius:8px;padding:12px 16px;margin:8px 0}
.mn-ending{font-weight:800;font-size:1em;text-align:left;margin:16px 0 8px;color:#374151}

/* تحسين الطباعة */
@media print{
  #minutesPreview{background:none!important;padding:0!important;gap:0!important}
  #minutesPreview .mn-page{box-shadow:none!important;border-radius:0!important;margin:0!important;page-break-after:always}
  #minutesPreview .mn-page:last-child{page-break-after:auto}
  .mn-table thead tr{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* ─── محرر نص داخل الصفحة الفارغة ──────────────────────────────── */
.lt-page-rte{
  display:flex;flex-direction:column;flex:1;
  margin:2mm 8mm 2mm;
  border:1px solid rgba(0,0,0,.13);border-radius:8px;overflow:hidden;
  background:rgba(255,255,255,.75);
  position:relative;z-index:1;
}
.lt-page-rte .lt-rte-bar{
  display:flex;flex-wrap:wrap;align-items:center;gap:3px;
  padding:5px 8px;background:#f4f6fa;border-bottom:1px solid #e2e8f0;
}
.lt-page-rte .lt-blank-editor{
  flex:1;padding:10px 14px;line-height:1.9;outline:none;
  min-height:55mm;text-align:justify;font-family:inherit;
}
.lt-page-rte .lt-blank-editor:focus{background:rgba(255,255,255,.9)}
@media print{
  .lt-page-rte{border:none;background:transparent}
  .lt-page-rte .lt-rte-bar{display:none}
}

/* ─── زر إخفاء/إظهار التوقيع في كل صفحة ────────────────────────── */
.lb-sign{position:relative}
.lb-seal-toggle{
  position:absolute;top:6px;left:6px;
  width:28px;height:28px;border-radius:50%;
  border:1px solid #e2e8f0;background:rgba(255,255,255,.9);
  font-size:14px;cursor:pointer;padding:0;
  display:flex;align-items:center;justify-content:center;
  z-index:5;box-shadow:0 1px 4px rgba(0,0,0,.12);
  transition:background .15s;
}
.lb-seal-toggle:hover{background:#f1f5f9}
@media print{.lb-seal-toggle{display:none!important}}

/* ─── علامة مائية ───────────────────────────────────────────────── */
.lb-watermark{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  pointer-events:none;z-index:0;
}
.lb-watermark img{
  width:55%;max-width:320px;opacity:0.07;filter:grayscale(1);
  user-select:none;
}
.letter-page{position:relative}

/* ─── تذييل الشركة ──────────────────────────────────────────────── */
.lb-footer{
  position:absolute;bottom:0;left:0;right:0;
  padding:8px 24px;
  border-top:1px solid #e2e8f0;
  background:rgba(255,255,255,0.88);
  z-index:2;
}
.lb-footer-inner{
  display:flex;flex-wrap:wrap;gap:4px 10px;align-items:center;
  font-size:0.72em;color:#4b5563;direction:rtl;
}
.lb-footer-inner b{color:#1c2649}
.lb-footer-sep{color:#cbd5e1;font-size:0.9em}

/* ─── تبويبات نافذة الإعدادات ───────────────────────────────────── */
.lt-modal-tabs{
  display:flex;gap:4px;border-bottom:2px solid #e2e8f0;margin-bottom:18px;
}
.lt-tab{
  padding:7px 16px;font-size:0.93em;font-family:inherit;cursor:pointer;
  background:none;border:none;border-bottom:2px solid transparent;
  color:#64748b;margin-bottom:-2px;transition:color .15s,border-color .15s;
  border-radius:4px 4px 0 0;
}
.lt-tab.active{color:#1c2649;border-bottom-color:#1c2649;font-weight:700}
.lt-tab:hover:not(.active){color:#1c2649;background:#f1f5f9}
.lt-modal-tab-panel{padding-top:4px}

/* ─── محرّر نص صفحة فارغة ──────────────────────────────────────── */
.lt-blank-editor{
  flex:1;width:100%;min-height:200px;padding:16px;
  font-size:inherit;color:inherit;line-height:1.9;direction:rtl;
  outline:none;white-space:pre-wrap;word-break:break-word;
  z-index:1;position:relative;
}
.lt-blank-editor:focus{background:rgba(255,255,255,0.06)}
.mn-body-blank.lt-blank-editor{min-height:340px}

/* ─── لوحة الصفحات الفارغة ─────────────────────────────────────── */
#ltBlankPagesBox{margin-top:12px}
#ltBlankPagesContainer{display:flex;flex-direction:column;gap:24px;margin-top:16px}
