/* ==========================================================
   لوحة موظف الدعم — تخصيصات فوق نظام التصميم المشترك
   ========================================================== */

.boot-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-body);
  z-index: 60;
}
.boot-screen[hidden] { display: none; }

/* ---------- بطاقة المستخدم في الشريط العلوي ---------- */
.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text-strong); }
.user-role { font-size: var(--fs-2xs); color: var(--text-muted); }
@media (max-width: 900px) { .user-meta { display: none; } }

/* ---------- عناصر الطابور ---------- */
.q-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--t-fast);
  position: relative;
}
.q-item:hover { background: var(--bg-surface-2); }
.q-item.active { background: var(--accent-soft); }
.q-item.active::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 3px;
  background: var(--accent);
}
.q-item.ringing { animation: ringGlow 1.5s infinite; }
@keyframes ringGlow {
  0%, 100% { background: var(--bg-surface); }
  50% { background: var(--warning-50); }
}
.q-main { flex: 1; min-width: 0; }
.q-top { display: flex; align-items: center; gap: var(--sp-2); }
.q-name { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text-strong); }
.q-sub { font-size: var(--fs-2xs); color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.q-preview { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.q-side { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); flex: none; }
.q-time { font-size: var(--fs-2xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.q-item.urgent .q-time { color: var(--danger-500); font-weight: var(--fw-bold); }

/* ---------- المحادثة ---------- */
.chat-col { position: relative; }
.chat-empty { flex: 1; display: grid; place-items: center; }
.chat-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-wrap.hidden { display: none; }

.chat-topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex: none;
}
.chat-scroll { flex: 1; }

.jump-btn {
  position: absolute;
  inset-block-end: 148px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--accent);
  font-size: var(--fs-2xs);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 5;
}

.upload-bar,
.record-bar {
  flex: none;
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: var(--fs-xs);
}
.record-bar { display: flex; align-items: center; gap: var(--sp-2); }

/* ---------- الردود السريعة ---------- */
.quick-replies {
  flex: none;
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3) 0;
  overflow-x: auto;
  background: var(--bg-surface);
  scrollbar-width: none;
}
.quick-replies::-webkit-scrollbar { display: none; }
.quick-replies:empty { display: none; }

/* ---------- شريط الإدخال ---------- */
.composer-wrap { flex: none; background: var(--bg-surface); border-top: 1px solid var(--border-subtle); }
.mode-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) 0;
}
.composer { border-top: 0; }
.composer-wrap.internal { background: var(--gold-100); }
.composer-wrap.internal .grow-input { border-color: var(--gold-400); background: var(--bg-surface); }

/* ---------- لوحة العميل ---------- */
.panel-section { padding: var(--sp-4); border-bottom: 1px solid var(--border-subtle); }
.panel-section:last-child { border-bottom: 0; }
.panel-title {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.panel-title .ico { width: 14px; height: 14px; }

.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
.mini-stat {
  padding: var(--sp-2);
  background: var(--bg-surface-2);
  border-radius: var(--r-sm);
  text-align: center;
}
.mini-stat .v { font-size: var(--fs-md); font-weight: var(--fw-black); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.mini-stat .l { font-size: var(--fs-2xs); color: var(--text-muted); }

.hist-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-xs);
}
.hist-row:hover { background: var(--bg-surface-2); }

.tl-item { display: flex; gap: var(--sp-3); padding-bottom: var(--sp-3); position: relative; }
.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  inset-inline-start: 8px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}
.tl-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--bg-surface-3);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  flex: none;
  z-index: 1;
}
.tl-dot .ico { width: 10px; height: 10px; }
.tl-dot.ok { background: var(--success-50); color: var(--success-600); }
.tl-dot.warn { background: var(--warning-50); color: var(--warning-600); }
.tl-dot.bad { background: var(--danger-50); color: var(--danger-600); }
.tl-body { flex: 1; min-width: 0; }
.tl-text { font-size: var(--fs-xs); color: var(--text-body); }
.tl-time { font-size: var(--fs-2xs); color: var(--text-subtle); }

.note-item {
  padding: var(--sp-2) var(--sp-3);
  background: var(--gold-100);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  margin-bottom: var(--sp-2);
  position: relative;
}
.note-item .note-meta { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 2px; }
.note-del {
  position: absolute;
  inset-inline-start: var(--sp-2);
  inset-block-start: var(--sp-2);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 0;
}

/* ---------- مكالمة واردة ---------- */
.ring-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-call);
  background: var(--bg-overlay);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  backdrop-filter: blur(3px);
}
.ring-overlay[hidden] { display: none; }
.ring-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--t-base);
}
.ring-pulse { margin: 0 auto var(--sp-3); animation: pulseRing 1.5s infinite; }
.ring-kind { margin-bottom: var(--sp-2); }
.ring-title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-strong); }
.ring-sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }

/* ---------- طبقة المكالمة ---------- */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-call);
  background: var(--gray-950);
  display: grid;
  place-items: center;
}
.call-overlay[hidden] { display: none; }
.remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--gray-950);
}
.local-video {
  position: absolute;
  inset-block-start: var(--sp-4);
  inset-inline-end: var(--sp-4);
  width: 168px;
  height: 118px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: var(--gray-900);
  z-index: 2;
}
.call-info {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  color: #fff;
  text-align: center;
}
.call-info.hidden { display: none; }
.call-name { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.call-state { font-size: var(--fs-sm); opacity: 0.75; }
.call-timer { font-size: var(--fs-md); }
.call-controls {
  position: absolute;
  inset-block-end: var(--sp-8);
  inset-inline: 0;
  display: flex;
  justify-content: center;
  gap: var(--sp-4);
  z-index: 3;
}
.call-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--t-fast), transform var(--t-fast);
}
.call-btn:hover { background: rgba(255, 255, 255, 0.26); }
.call-btn:active { transform: scale(0.94); }
.call-btn .ico { width: 23px; height: 23px; }
.call-btn.danger { background: var(--danger-500); }
.call-btn.danger:hover { background: var(--danger-600); }
.call-btn.off { background: #fff; color: var(--gray-900); }

/* ---------- تفاصيل صغيرة ---------- */
.text-2xs { font-size: var(--fs-2xs); }
.min-w-0 { min-width: 0; }
.kv-tech dt { font-family: var(--font-sans); }
.kv-tech dd { direction: ltr; text-align: right; unicode-bidi: plaintext; }

@media (max-width: 760px) {
  .quick-replies { padding-inline: var(--sp-2); }
  .local-video { width: 104px; height: 142px; }
}
