:root {
    --t-bg:#fff;
    --t-text:#111317;
    --t-muted:#6b7280;
    --t-border:#e6e8ec;
    --t-shadow:0 10px 35px rgba(15,23,42,.14);
    --t-radius:16px;

    --t-success:#16a34a;
    --t-error:#dc2626;
    --t-warning:#f59e0b;
    --t-info:#2563eb;
    --t-loader:#2196f3;
  }

  /* ===== الأساسيات العامة ===== */
  .jq-toast-wrap {
    z-index: 11150 !important;
    font-family: 'Cairo', sans-serif !important;
    position: fixed !important;
    width: auto !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    pointer-events: none; /* حتى لا تمنع اللمس بالخلفية */
  }

  /* ===== تموضع صريح لكل الحالات مع دعم RTL/LTR ===== */
  /* أعلى يمين */
  .jq-toast-wrap.top-right {
    inset: 12px 12px auto auto !important; /* top right */
  }
  /* أعلى يسار */
  .jq-toast-wrap.top-left {
    inset: 12px auto auto 12px !important; /* top left */
  }
  /* أسفل يمين */
  .jq-toast-wrap.bottom-right {
    inset: auto 12px 12px auto !important; /* bottom right */
  }
  /* أسفل يسار */
  .jq-toast-wrap.bottom-left {
    inset: auto auto 12px 12px !important; /* bottom left */
  }
  /* منتصف علوي */
  .jq-toast-wrap.top-center,
  .jq-toast-wrap.mid-center {
    left: 50% !important; right: auto !important; top: 12px !important; bottom: auto !important;
    transform: translateX(-50%);
  }
  /* منتصف سفلي */
  .jq-toast-wrap.bottom-center,
  .jq-toast-wrap.mid-bottom {
    left: 50% !important; right: auto !important; bottom: 12px !important; top: auto !important;
    transform: translateX(-50%);
  }

  /* في الصفحات العربية: لو كانت المكتبة ترسل top-left خطأً، قلبه لليمين */
  html[lang="ar"] .jq-toast-wrap.top-left,
  html[lang="ae"] .jq-toast-wrap.top-left {
    inset: 12px 12px auto auto !important; /* اجبره أعلى يمين */
  }
  html[lang="ar"] .jq-toast-wrap.bottom-left,
  html[lang="ae"] .jq-toast-wrap.bottom-left {
    inset: auto 12px 12px auto !important; /* اجبره أسفل يمين */
  }

  /* ===== الشكل العام للكرت ===== */
  .jq-toast-single {
    font-family: 'Cairo', sans-serif !important;
    background: var(--t-bg) !important;
    color: var(--t-text) !important;
    border: 1px solid var(--t-border) !important;
    border-radius: var(--t-radius) !important;
    box-shadow: var(--t-shadow) !important;
    padding: 16px 18px !important;
    line-height: 1.6 !important;
    max-width: 460px !important;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px) scale(.97);
    animation: toastIn .3s ease-out forwards;
    pointer-events: auto; /* يسمح بالنقر على زر الإغلاق */
  }

  @keyframes toastIn { to { opacity: 1; transform: translateY(0) scale(1); } }

  /* ===== دعم RTL & LTR للنص ===== */
  html[lang="ae"] .jq-toast-single,
  html[lang="ar"] .jq-toast-single { direction: rtl; text-align: right !important; }
  html[lang="en"] .jq-toast-single { direction: ltr; text-align: left !important; }

  /* ===== bar جانبي لوني حسب النوع ===== */
  .jq-toast-single { border-inline-start: 6px solid transparent !important; }
  .jq-icon-success { border-inline-start-color: var(--t-success) !important; }
  .jq-icon-error   { border-inline-start-color: var(--t-error)   !important; }
  .jq-icon-warning { border-inline-start-color: var(--t-warning) !important; }
  .jq-icon-info    { border-inline-start-color: var(--t-info)    !important; }

  /* ===== العنوان والنص ===== */
  .jq-toast-single .jq-toast-heading {
    font-weight: 700 !important;
    font-size: 16px !important;
    margin: 0 0 6px !important;
    color: var(--t-text) !important;
  }
  .jq-toast-single p {
    font-size: 14px !important;
    color: var(--t-text) !important;
    margin: 0 !important;
  }

  /* ===== الأيقونة الدائرية ===== */
  .jq-toast-single.jq-has-icon { padding-inline-start: 70px !important; }
  .jq-toast-single.jq-has-icon::before {
    content: "";
    position: absolute;
    inset-inline-start: 18px; top: 50%;
    transform: translateY(-50%);
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #f3f4f6;
    box-shadow: inset 0 0 2px rgba(0,0,0,.06);
  }
  .jq-toast-single.jq-has-icon::after {
    position: absolute;
    inset-inline-start: 18px; top: 50%;
    transform: translateY(-50%);
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 18px;
  }
  .jq-icon-success::after { content: "✔"; color: var(--t-success); }
  .jq-icon-error::after   { content: "×"; color: var(--t-error); }
  .jq-icon-warning::after { content: "!"; color: var(--t-warning); }
  .jq-icon-info::after    { content: "i"; color: var(--t-info); }

  /* ===== شريط اللودر ===== */
  .jq-toast-loader {
    height: 3px !important;
    top: 0 !important; bottom: auto !important; left: 0 !important; right: 0 !important;
    background: rgba(0,0,0,.05) !important;
  }
  .jq-toast-loaded { background: var(--t-loader) !important; }

  /* ===== زر الإغلاق ===== */
  .jq-toast-single .close-jq-toast-single {
    position: absolute !important;
    top: 10px !important;
    inset-inline-end: 10px !important;
    color: var(--t-muted) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    opacity: .85 !important;
    transition: opacity .15s ease;
    font-family: 'Cairo', sans-serif !important;
  }
  .jq-toast-single .close-jq-toast-single:hover { opacity: 1 !important; }

  /* ===== موبايل: تثبيت الحواف ومنع الانزياح للشمال ===== */
  @media (max-width: 480px) {
    .jq-toast-wrap {
      width: calc(100vw - 24px) !important;
    }
    /* إجبار أعلى يمين في العربية */
    html[lang="ar"] .jq-toast-wrap.top-right,
    html[lang="ae"] .jq-toast-wrap.top-right {
      inset: 40px 12px auto auto !important;
    }
    html[lang="ar"] .jq-toast-wrap.bottom-right,
    html[lang="ae"] .jq-toast-wrap.bottom-right {
      inset: auto 12px 12px auto !important;
    }
    /* ومنع تمدد غير متوقع */
    .jq-toast-single { width: 100% !important; border-radius: 14px !important; }
  }

