.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-panel {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop var(--transition-smooth) ease-out;
}

.modal-panel.modal-sm {
  max-width: 430px;
}

.modal-panel.modal-lg {
  max-width: 780px;
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface-subtle);
}

/* اللوحة الجانبية لملف المريض */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: flex-end;
  z-index: 55;
}

.drawer-panel {
  width: 100%;
  max-width: 720px;
  height: 100%;
  background: var(--bg-surface);
  border-inline-start: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInDrawer var(--transition-smooth) ease-out;
}

.drawer-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-kv-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.detail-kv-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
  word-break: break-word;
}

/* الإشعارات */
.toast-container {
  position: fixed;
  inset-inline-end: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 80;
  max-width: 360px;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  animation: fadeIn var(--transition-fast) ease-out;
}

.toast.toast-success {
  border-inline-start-color: var(--success);
}

.toast.toast-warning {
  border-inline-start-color: var(--warning);
}

.toast.toast-danger {
  border-inline-start-color: var(--danger);
}

.error-boundary-box {
  max-width: 560px;
  margin: 64px auto;
  padding: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 540px) {
  .detail-kv-grid {
    grid-template-columns: 1fr;
  }

  .toast-container {
    inset-inline-start: 16px;
    inset-inline-end: 16px;
    bottom: 16px;
    max-width: none;
  }
}
