@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@500;600;700;800;900&display=swap');

#rifd-manager-assistant,
.rifd-assistant-toast {
  font-family: "Tajawal", Tahoma, Arial, sans-serif;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

.rifd-assistant-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483500;
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 18px;
  background: linear-gradient(135deg, #102f63, #174a84);
  color: #fff;
  font: 800 16px/1 "Tajawal", Tahoma, sans-serif;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(15,46,97,.28);
}

.rifd-assistant-fab svg,
.rifd-assistant-mark svg {
  width: 23px;
  height: 23px;
  fill: #42d9ad;
}

.rifd-assistant-fab b {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 99px;
  background: #ff6b6b;
  font-size: 12px;
}

.rifd-assistant-fab.loading { width: 54px; padding: 0; justify-content: center; }
.rifd-assistant-fab.loading svg { animation: rifd-assistant-pulse 1.2s ease-in-out infinite; }

.rifd-assistant-panel {
  position: fixed;
  right: 24px;
  bottom: 90px;
  z-index: 2147483499;
  width: min(520px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 116px));
  overflow: hidden;
  border: 1px solid #dae5ee;
  border-radius: 25px;
  background: #f7f9fc;
  box-shadow: 0 28px 80px rgba(7,23,80,.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px) scale(.985);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

.rifd-assistant-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.rifd-assistant-head {
  display: grid;
  grid-template-columns: 48px 1fr 38px;
  align-items: center;
  gap: 12px;
  padding: 21px;
  background: linear-gradient(135deg, #0c2d61, #174e88);
  color: #fff;
}

.rifd-assistant-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  background: rgba(255,255,255,.1);
}

.rifd-assistant-head span { color: #a9dcca; font-size: 13px; font-weight: 700; }
.rifd-assistant-head h2 { margin: 3px 0 0; font-size: 18px; line-height: 1.45; }

.rifd-assistant-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
}

.rifd-assistant-close svg,
.rifd-assistant-insight button svg,
.rifd-assistant-item-actions svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rifd-assistant-insight {
  margin: 16px 16px 10px;
  padding: 15px 16px;
  border: 1px solid #ccece3;
  border-radius: 17px;
  background: #eef9f6;
}

.rifd-assistant-insight > span { color: #167a65; font-size: 12px; font-weight: 800; }
.rifd-assistant-insight p { margin: 5px 0 12px; color: #173761; font-size: 14px; font-weight: 700; line-height: 1.75; }
.rifd-assistant-insight button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: #d9f1ea;
  color: #176855;
  font: 700 12px/1 "Tajawal", sans-serif;
  cursor: pointer;
}

.rifd-assistant-departments {
  display: flex;
  gap: 7px;
  padding: 7px 16px 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.rifd-assistant-departments button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid #dbe4ee;
  border-radius: 99px;
  background: #fff;
  color: #516279;
  font: 700 12px/1 "Tajawal", sans-serif;
  cursor: pointer;
}

.rifd-assistant-departments button.active { border-color: #163f75; background: #163f75; color: #fff; }
.rifd-assistant-departments b { display: grid; min-width: 18px; height: 18px; place-items: center; border-radius: 99px; background: #ffebeb; color: #d34848; font-size: 10px; }
.rifd-assistant-departments i { color: #18a27f; font-style: normal; }

.rifd-assistant-list {
  max-height: min(395px, calc(100dvh - 405px));
  min-height: 155px;
  padding: 3px 16px 12px;
  overflow-y: auto;
}

.rifd-assistant-item {
  margin-bottom: 10px;
  padding: 15px;
  border: 1px solid #dfe6ee;
  border-right: 4px solid #e8b84b;
  border-radius: 16px;
  background: #fff;
}

.rifd-assistant-item.priority-high { border-right-color: #ff6b6b; }
.rifd-assistant-item.priority-low { border-right-color: #33d6a6; }
.rifd-assistant-item-head { display: flex; align-items: center; justify-content: space-between; }
.rifd-assistant-priority { padding: 4px 8px; border-radius: 8px; background: #fff5dc; color: #916900; font-size: 11px; font-weight: 800; }
.priority-high .rifd-assistant-priority { background: #fff0f0; color: #bc3e3e; }
.priority-low .rifd-assistant-priority { background: #eaf9f4; color: #18846a; }
.rifd-assistant-age { color: #7a899c; font-size: 11px; font-weight: 700; }
.rifd-assistant-item h3 { margin: 10px 0; color: #17345f; font-size: 15px; line-height: 1.55; }
.rifd-assistant-item dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.rifd-assistant-item dl div { padding: 9px 10px; border-radius: 11px; background: #f5f7fa; }
.rifd-assistant-item dt { color: #79869a; font-size: 10px; font-weight: 700; }
.rifd-assistant-item dd { margin: 3px 0 0; color: #2a4368; font-size: 12px; font-weight: 800; }
.rifd-assistant-item-actions { display: flex; gap: 8px; margin-top: 12px; }
.rifd-assistant-item-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #d5e0ea;
  border-radius: 10px;
  background: #fff;
  color: #284b77;
  font: 700 11px/1 "Tajawal", sans-serif;
  cursor: pointer;
}
.rifd-assistant-item-actions button:first-child { border-color: #17477f; background: #17477f; color: #fff; }

.rifd-assistant-empty {
  display: flex;
  min-height: 145px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #65758b;
  text-align: center;
}

.rifd-assistant-empty svg { width: 28px; height: 28px; margin-bottom: 9px; fill: #27b98f; }
.rifd-assistant-empty strong { color: #29466d; font-size: 14px; }
.rifd-assistant-empty p { margin: 5px 0 0; font-size: 12px; }
.rifd-assistant-panel footer { padding: 11px 16px 13px; border-top: 1px solid #e5ebf1; color: #7d8999; font-size: 10px; text-align: center; }

.rifd-assistant-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 2147483647;
  padding: 11px 18px;
  border-radius: 12px;
  background: #102f63;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: .2s ease;
  pointer-events: none;
}

.rifd-assistant-toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rifd-assistant-pulse { 50% { opacity: .45; transform: scale(.9); } }

@media (max-width: 620px) {
  .rifd-assistant-fab { right: 14px; bottom: 14px; }
  .rifd-assistant-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 88dvh;
    border-radius: 24px 24px 0 0;
    transform-origin: bottom center;
  }
  .rifd-assistant-list { max-height: calc(88dvh - 380px); }
  .rifd-assistant-item dl { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .rifd-assistant-panel,
  .rifd-assistant-toast { transition: none; }
  .rifd-assistant-fab.loading svg { animation: none; }
}
