#alh-contract-calc,
#alh-contract-calc *{
  box-sizing:border-box;
  direction:rtl;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Inter",sans-serif;
}

#alh-contract-calc{
  --acc-bg:#050816;
  --acc-card:#0b1120;
  --acc-purple:#7b3aed;
  --acc-purple-soft:rgba(123,58,237,.35);
  --acc-text:#e7e9ee;
  --acc-muted:#9aa3b2;
  --acc-good:#16a34a;
  --acc-bad:#ef4444;
  --acc-border:#272a3a;
  --acc-radius:18px;
  --acc-gap:18px;
  --acc-cell-h:38px;
  --acc-shadow:0 18px 40px rgba(15,23,42,.75);

  color:var(--acc-text);
  background:transparent;
  padding:12px;
}

#alh-contract-calc .acc-card{
  background:radial-gradient(circle at top,#111827 0,#020617 45%,#020617 100%);
  border-radius:32px;
  border:1px solid rgba(148,163,184,.25);
  padding:24px 24px 28px;
  box-shadow:var(--acc-shadow);
}

/* ===== الهيدر ===== */
#alh-contract-calc .acc-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  margin-bottom:26px;
  border-bottom:1px solid rgba(148,163,184,.12);
  padding-bottom:14px;
}

#alh-contract-calc .acc-title-group{
  display:flex;
  flex-direction:column;
  gap:4px;
}

#alh-contract-calc .acc-title{
  margin:0;
  font-size:22px;
  font-weight:700;
  letter-spacing:.03em;
  color:#f9fafb;
}
#alh-contract-calc .acc-subtitle{
  margin:0;
  font-size:13px;
  color:var(--acc-muted);
}

#alh-contract-calc .acc-header-actions{
  display:flex;
  align-items:flex-end;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

/* ===== الأقسام ===== */
#alh-contract-calc .acc-section{
  margin-bottom:22px;
  padding:16px 14px 18px;
  border-radius:24px;
  border:1px solid rgba(148,163,184,.16);
  background:linear-gradient(135deg,rgba(15,23,42,.95),rgba(15,23,42,.98));
}

#alh-contract-calc .acc-section-title{
  margin:0 0 12px;
  font-size:15px;
  font-weight:600;
  color:#e5e7eb;
  display:flex;
  align-items:center;
  gap:8px;
}

/* ===== الشبكات ===== */
#alh-contract-calc .acc-grid{
  display:grid;
  gap:var(--acc-gap);
}

/* 4 أعمدة ثابتة على الشاشات العادية (مثل قسم حجم الصفقة) */
#alh-contract-calc .acc-grid-3{
  grid-template-columns:repeat(3,minmax(0,1fr));
}
#alh-contract-calc .acc-grid-4{
  grid-template-columns:repeat(4,minmax(0,1fr));
}

#alh-contract-calc .acc-grid-bottom{
  margin-top:12px;
}

/* ===== الحقول ===== */
#alh-contract-calc .acc-field{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}

/* عناوين الخلايا في منتصف العمود */
#alh-contract-calc label{
  font-size:12px;
  color:var(--acc-muted);
  display:flex;
  justify-content:center;
  align-items:center;
  text-align:center;
  gap:4px;
}

#alh-contract-calc .acc-cur{
  font-size:11px;
  color:var(--acc-purple-soft);
  margin-right:5px;
}

/* خلفية سوداء لكل الحقول اليدوية */
#alh-contract-calc .acc-input,
#alh-contract-calc .acc-select,
#alh-contract-calc .acc-currency-row input{
  width:100%;
  height:var(--acc-cell-h);
  border-radius:999px;
  border:1px solid var(--acc-border);
  background:#000000;
  color:var(--acc-text);
  padding:0 12px;
  font-size:13px;
  text-align:center;
  outline:none;
  transition:border-color .16s ease,box-shadow .16s ease,background .16s ease;
}

#alh-contract-calc .acc-input:focus,
#alh-contract-calc .acc-select:focus,
#alh-contract-calc .acc-currency-row input:focus{
  border-color:var(--acc-purple);
  box-shadow:0 0 0 1px rgba(123,58,237,.7);
  background:#020617;
}

#alh-contract-calc .acc-input::placeholder,
#alh-contract-calc .acc-currency-row input::placeholder{
  color:#4b5563;
  font-size:12px;
}

/* التحكم بالعملة في الهيدر (نخلي العنوان يمين) */
#alh-contract-calc .acc-control{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:150px;
}
#alh-contract-calc .acc-control label{
  justify-content:space-between;
  text-align:right;
}

/* ===== الأزرار ===== */
#alh-contract-calc .acc-btn{
  border-radius:999px;
  border:none;
  padding:0 16px;
  height:34px;
  font-size:13px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  white-space:nowrap;
  transition:background .16s ease,color .16s ease,transform .07s ease,box-shadow .16s ease,border-color .16s ease;
}

#alh-contract-calc .acc-btn.primary{
  background:linear-gradient(135deg,#7b3aed,#a855f7);
  color:#f9fafb;
  box-shadow:0 0 0 1px rgba(168,85,247,.5);
}
#alh-contract-calc .acc-btn.primary:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 25px rgba(88,28,135,.8);
}

#alh-contract-calc .acc-btn.gray{
  background:#111827;
  color:var(--acc-text);
  border:1px solid var(--acc-border);
}
#alh-contract-calc .acc-btn.gray:hover{
  background:#0b1120;
}

#alh-contract-calc .acc-btn.ghost{
  background:rgba(123,58,237,.08);
  color:var(--acc-purple);
  border:1px solid rgba(123,58,237,.35);
}
#alh-contract-calc .acc-btn.ghost:hover{
  background:rgba(123,58,237,.18);
}
#alh-contract-calc .acc-btn.full{
  width:100%;
}
#alh-contract-calc .acc-btn:active{
  transform:translateY(1px) scale(.99);
}

/* ملاحظات */
#alh-contract-calc .acc-note{
  margin:0;
  font-size:12px;
  color:var(--acc-muted);
  line-height:1.5;
}
#alh-contract-calc .acc-field-note{
  display:flex;
  align-items:center;
}

/* ===== نتائج الهدف/الاستوب ===== */
#alh-contract-calc .acc-results-row{
  margin-top:14px;
}
#alh-contract-calc .acc-result{
  width:100%;
  height:var(--acc-cell-h);
  border-radius:999px;
  border:1px solid var(--acc-border);
  background:rgba(15,23,42,.85);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  text-align:center;
}
#alh-contract-calc .acc-result.acc-good{
  border-color:rgba(22,163,74,.5);
  color:var(--acc-good);
}
#alh-contract-calc .acc-result.acc-bad{
  border-color:rgba(239,68,68,.6);
  color:var(--acc-bad);
}

#alh-contract-calc .acc-save-status{
  font-size:12px;
  color:var(--acc-muted);
  min-width:110px;
  text-align:left;
}

/* ===== نافذة الإعدادات ===== */
#alh-contract-calc .acc-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.75);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
  padding:16px;
}
#alh-contract-calc .acc-modal-backdrop.is-open{
  display:flex;
}
#alh-contract-calc .acc-modal{
  width:100%;
  max-width:600px;
  border-radius:24px;
  background:#020617;
  border:1px solid rgba(148,163,184,.35);
  box-shadow:0 24px 60px rgba(15,23,42,1);
  padding:16px 18px 18px;
}

#alh-contract-calc .acc-modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(148,163,184,.2);
  padding-bottom:8px;
  margin-bottom:10px;
}
#alh-contract-calc .acc-modal-header h3{
  margin:0;
  font-size:16px;
  color:#f9fafb;
}
#alh-contract-calc .acc-modal-close{
  width:28px;
  height:28px;
  border-radius:999px;
  border:none;
  background:#111827;
  color:#9ca3af;
  font-size:18px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
#alh-contract-calc .acc-modal-close:hover{
  background:#1f2937;
  color:#e5e7eb;
}

#alh-contract-calc .acc-modal-body{
  padding:4px 2px 10px;
  max-height:60vh;
  overflow:auto;
}
#alh-contract-calc .acc-modal-footer{
  padding-top:10px;
  border-top:1px solid rgba(148,163,184,.2);
}

/* ===== جدول العملات ===== */
#alh-contract-calc .acc-currency-table{
  margin-top:8px;
  border-radius:18px;
  border:1px solid rgba(148,163,184,.35);
  overflow:hidden;
}

/* عناوين الأعمدة – في المنتصف */
#alh-contract-calc .acc-currency-header{
  display:grid;
  grid-template-columns:1.1fr 1.6fr 1.1fr .6fr;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  font-size:12px;
  background:rgba(15,23,42,1);
  color:var(--acc-muted);
  border-bottom:1px solid rgba(148,163,184,.25);
  font-weight:500;
}
#alh-contract-calc .acc-currency-header span{
  text-align:center;
  justify-self:center;
}

#alh-contract-calc .acc-currency-row{
  display:grid;
  grid-template-columns:1.1fr 1.6fr 1.1fr .6fr;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  font-size:12px;
  background:rgba(15,23,42,.85);
  border-bottom:1px solid rgba(31,41,55,.8);
}
#alh-contract-calc .acc-currency-row:last-child{
  border-bottom:none;
}

#alh-contract-calc .acc-currency-row button{
  width:28px;
  height:28px;
  border-radius:999px;
  border:none;
  background:#111827;
  color:#f97373;
  cursor:pointer;
  font-size:16px;
  display:flex;
  align-items:center;
  justify-content:center;
}
#alh-contract-calc .acc-currency-row button:hover{
  background:#1f2937;
}

/* ===== استجابة للموبايل فقط ===== */
@media (max-width:640px){
  #alh-contract-calc .acc-grid-3,
  #alh-contract-calc .acc-grid-4{
    grid-template-columns:1fr;
  }
  #alh-contract-calc{
    padding:8px 4px;
  }
  #alh-contract-calc .acc-card{
    padding:18px 16px 20px;
  }
  #alh-contract-calc .acc-header{
    flex-direction:column;
    align-items:flex-start;
  }
  #alh-contract-calc .acc-header-actions{
    justify-content:flex-start;
    gap:8px;
  }
  #alh-contract-calc .acc-control{
    width:100%;
  }
  #alh-contract-calc .acc-btn{
    flex:1 1 auto;
  }
}
