  /* --- namespaced styles (mgly-...) --- */
  :root {
      --mgly-bg: #fff;
      --mgly-accent: #0d6efd;
      --mgly-muted: #6b7280;
      --mgly-panel-w: 380px;
  }

  .mgly-btn-toggle {
      position: fixed;
      right: 10px;
      bottom: 10px;
      height: 60px;
      width: 60px;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 2px 0px 0px 0px;
      z-index: 1400;
      border-radius: 25px;
      border: none;
      background: #1a53d4;
      cursor: pointer;
      box-shadow: 0 4px 4px 0 rgba(87, 75, 172, .15);
  }

  .mgly-btn-toggle svg {
      display: block
  }

  .mgly-toggle-label {
      font-size: 15px;
      line-height: 1;
      color: white !important;
  }

  rect#right-eye {
      color: aquamarine;
  }

  rect#left-eye {
      color: #ffc107;
  }

  circle.antenna-pulse {
      color: #ffc107;
  }

  path {
      color: #ffffff;
  }

  .mgly-panel {
      position: fixed;
      box-sizing: border-box;
      top: 70px;
      right: 10px;
      display: flex;
      flex-direction: column;
      bottom: 78px;
      z-index: 1111111;
      width: var(--mgly-panel-w);
      max-width: calc(100% - 36px);
      border-radius: 12px;
      background: var(--mgly-bg);
      box-shadow: 0 20px 48px rgba(11, 17, 28, .16);
      transform: translateY(12px) scale(.98);
      opacity: 0;
      pointer-events: none;
      transition: transform .18s ease, opacity .18s ease;
      overflow: hidden;
      font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Arabic', sans-serif;
  }


  @media (max-width: 520px) {
      .mgly-panel {
          width: 100% !important;
          max-width: 100% !important;
          top: 0;
          right: 0;
          left: 0;
          border-top-left-radius: 0;
          border-top-right-radius: 0;
          height: calc(100dvh - 96px);
          /* أو calc(100vh - 96px) كـ fallback */

      }
  }

  .mgly-panel[aria-hidden="false"] {
      transform: translateY(0) scale(1);
      opacity: 1;
      pointer-events: auto;
  }

  .mgly-panel-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 14px;
      border-bottom: 1px solid #d0dcf2;
      background: linear-gradient(180deg, #d0dcf2, #fff);
  }

  .mgly-panel-title strong {
      display: block;
      font-size: 18px;
      color: #0b1220
  }

  .mgly-subtitle {
      font-size: 12px;
      color: var(--mgly-muted);
      margin-top: 4px
  }

  .mgly-close {
      background: transparent;
      border: 0;
      color: #374151;
      font-size: 16px;
      cursor: pointer;
  }

  .mgly-actions {
      flex: 1 1 auto;
      min-height: 0;
      overflow: auto;
      padding: 12px;
      display: flex !important;
      flex-direction: column;
      gap: 10px;
  }

  .mgly-action {
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      border: 1px solid #eef6ff;
      background: #ffffff;
      text-decoration: none;
      color: #0b1220;
      font-weight: 700;
      box-shadow: 0 6px 18px rgba(11, 17, 28, 0.03);
      transition: transform .12s ease, box-shadow .12s ease;
  }

  .mgly-action:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 28px rgba(11, 17, 28, 0.06)
  }

  .mgly-action .mgly-right {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: var(--mgly-accent);
      font-weight: 800
  }

  .mgly-action small {
      display: block;
      font-weight: 400;
      color: var(--mgly-muted);
      font-size: 12px;
      margin-top: 6px
  }

  /* Directional helpers: will be toggled by JS (add class .mgly-rtl or .mgly-ltr on <body>) */
  body.mgly-rtl .mgly-btn-toggle {
      left: 10px;
      right: auto;
  }

  body.mgly-rtl .mgly-panel {
      left: 10px;
      right: auto;
      text-align: right;
  }

  body.mgly-rtl .mgly-action {
      direction: rtl;
  }

  body.mgly-rtl .mgly-action .mgly-right {
      order: 0;
      margin-left: 0;
      margin-right: 8px;
  }

  body.mgly-ltr .mgly-btn-toggle {
      right: 10px;
      left: auto;
  }

  body.mgly-ltr .mgly-panel {
      right: 10px;
      left: auto;
      text-align: left;
  }

  body.mgly-ltr .mgly-action {
      direction: ltr;
  }

  body.mgly-ltr .mgly-action .mgly-right {
      order: 1;
      margin-right: 0;
      margin-left: 8px;
  }

  .mgly-panel-footer {
      padding: 10px 12px;
      border-top: 1px solid #d0dcf2;
      background: linear-gradient(269deg, #1a4ec636 0%, #d0dcf27d 20%, #ffffff 100%);
      text-align: center;
      flex: 0 0 auto;
      height: 60px;
      box-sizing: border-box;

  }

  .mgly-muted {
      color: var(--mgly-muted);
      font-size: 12px
  }


  .mgly-robot-wrap {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
  }

  /* Robot Animation Styles */
  #mgly-robot-svg {
      transition: all 0.3s ease;
      color: #dedede;
  }

  .mgly-btn-toggle:hover #mgly-robot-svg {
      transform: scale(1.05);
  }

  /* Halo Animation */
  .mgly-robot-halo {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 60px;
      height: 60px;
      border-radius: 50%;
      border: 2px solid rgba(255, 255, 255, 0.6);
      opacity: 0;
      pointer-events: none;
  }

  .mgly-btn-toggle .mgly-robot-halo {
      animation: pulse 2s infinite;
  }

  @keyframes pulse {
      0% {
          transform: translate(-50%, -50%) scale(0.8);
          opacity: 0.8;
      }

      70% {
          transform: translate(-50%, -50%) scale(1.2);
          opacity: 0;
      }

      100% {
          transform: translate(-50%, -50%) scale(1.2);
          opacity: 0;
      }
  }

  /* Robot Animation States */
  .mgly-btn-toggle.active #mgly-robot-svg {
      animation: robot-bounce 0.5s ease;
  }

  @keyframes robot-bounce {

      0%,
      100% {
          transform: translateY(0);
      }

      50% {
          transform: translateY(-10px);
      }
  }

  /* Eye Blink Animation */
  .eye-blink {
      animation: eye-blink 3s infinite;
  }

  @keyframes eye-blink {

      0%,
      90%,
      100% {
          transform: scaleY(1);
      }

      95% {
          transform: scaleY(0.1);
      }
  }

  /* Helpful Animation */
  .helpful-animation {
      animation: helpful 2s infinite;
  }

  @keyframes helpful {

      0%,
      100% {
          transform: rotate(0);
      }

      25% {
          transform: rotate(5deg);
      }

      75% {
          transform: rotate(-5deg);
      }
  }

  /* Listening Animation */
  .listening-animation {
      animation: listening 1.5s infinite;
  }

  @keyframes listening {

      0%,
      100% {
          transform: scale(1);
      }

      50% {
          transform: scale(1.1);
      }
  }

  .mgly-toggle-label {
      font-weight: 600;
  }